如何仅通过ghc获取没有main函数的目标文件?
[源代码]
数据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.o而不必定义main 。 
上一篇: How to get only the object file without main function by ghc?
下一篇: Evaluation of Haskell Statements/Expressions using GHC API
