Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
[源代码]
数据 FooBar = Foo | 酒吧
[命令]
$ ghc -c foo_bar.hs foo_bar.hs:1:0: 函数 'main' 未在模块 'Main' 中定义
[配置]
Glasgow Haskell 编译器,版本 6.12.3,用于 Haskell 98,阶段 2,由 GHC 版本 6.10.4 启动
您应该在模块中定义您的类型,然后编译它:
module Test where data FooBar = Foo | Bar
通过调用,无需定义即可生成ghc -c foo_bar.hs目标文件。foo_bar.omain
ghc -c foo_bar.hs
foo_bar.o
main
...