Haskell的主要定义在哪里?
在Haskell中,编译程序的执行开始于模块main
中执行main
。此功能必须为类型io()
。
哪个标准或参考定义了上述?
haskell> haskell> haskell 2010 www.haskell.org/onlinereport/intro.html“ rel =” nofollow noreferrer“> haskell 98 请勿正式定义main
(尽管有几个称为的函数示例主
),而是说:
我们离开作为实施,取决于要操纵,解释,编译等的Haskell程序的方式等。
我们以实施的方式 “ rel =“ nofollow noreferrer”> GHC用户指南指示用户创建main
函数,但从未提及其所需类型,或者是程序执行的开始。有参考MAIN
模块,但不是MAIM
函数。
比较 c ++ (参考文献C11标准(ISO/IEC 9899:2011:2011)5.1。 2.2.1程序启动(P:13)):
每个c程序[...]包含称为main的函数的定义[...],该函数是指定的程序的开始。
哪个标准或参考文献说main
是Haskell程序执行的开始?
In Haskell, the execution of a compiled program starts with executing main
in module Main
. This function must be of type IO ()
.
Which standard or reference defines the above?
Haskell 2010 and Haskell 98 don't define main
formally (although there are several examples of functions called main
), instead saying:
We leave as implementation dependent the ways in which Haskell programs are to be manipulated, interpreted, compiled, etc.
GHC User's Guide instructs the user to create a main
function but never mentions its required type or that it is the start of the program execution. There are references to the Main
module but not main
function.
Compare C++ (references C11 standard (ISO/IEC 9899:2011) 5.1.2.2.1 Program startup (p: 13)):
Every C program [...] contains the definition [...] of a function called main, which is the designated start of the program.
Which standard or reference says that main
is the start of execution of a Haskell program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https://www.haskell.org/onlinereport/haskell2010/haskellch5.html #DX11-98001
https://www.haskell.org/onlinereport/haskell2010/haskellch5.html#dx11-98001