Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第 5 章载入模块和生成可执行文件一节中对译注的疑问 #105

Open
scarletsky opened this issue Jan 17, 2016 · 0 comments
Open

Comments

@scarletsky
Copy link
Contributor

在入模块和生成可执行文件一节中,

-- file: ch05/Main.hs
module Main (main) where
import SimpleJSON
main = print (JObject [("foo", JNumber 1), ("bar", JBool False)])

[译注:原文说,可以不导出 main 函数,但是实际中测试这种做法并不能通过编译。]

但在我测试过程中,是可以通过编译的。

➜  ch05  ls
Main.hs       SimpleJSON.hs

➜  ch05  cat Main.hs
import SimpleJSON

main = print (JObject [("foo", JNumber 1), ("bar", JBool False)])

➜  ch05  ghc -o simple Main.hs
[1 of 2] Compiling SimpleJSON       ( SimpleJSON.hs, SimpleJSON.o )
[2 of 2] Compiling Main             ( Main.hs, Main.o )
Linking simple ...

➜  ch05  ls
Main.hi       Main.o        SimpleJSON.hs simple
Main.hs       SimpleJSON.hi SimpleJSON.o

➜  ch05  ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant