To write or not to write `module Main where` in Haskell

不想你离开。 提交于 2019-12-03 05:31:14
jdeseno

There isn't really a difference, module Main (main) where would be the implicit definition when you don't specify a header yourself. From the Haskell 98 Report:

An abbreviated form of module, consisting only of the module body, is permitted. If this is used, the header is assumed to be module Main(main) where.

I would prefer an explicit definition to an implicit one but, for a Main.hs it's a minor preference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!