Haskell的主要定义在哪里?

发布于 2025-01-25 07:11:03 字数 1038 浏览 3 评论 0原文

在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

又爬满兰若 2025-02-01 07:11:03

a haskell program 是一个模块的集合,按照惯例,必须称为main,并且必须导出值main 。程序的 value 是标识符main在模块main中的值,它必须是类型io> IOτ< /code>对于某些类型τ(请参阅第一章7 )。执行程序后,将执行计算MAIN,并丢弃其结果(类型τ)。

https://www.haskell.org/onlinereport/haskell2010/haskellch5.html #DX11-98001

A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main. The value of the program is the value of the identifier main in module Main, which must be a computation of type IO τ for some type τ (see Chapter 7). When the program is executed, the computation main is performed, and its result (of type τ) is discarded.

https://www.haskell.org/onlinereport/haskell2010/haskellch5.html#dx11-98001

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文