문제

[Source Code]

data FooBar = Foo | Bar

[Command]

$ ghc -c foo_bar.hs
foo_bar.hs:1:0: The function 'main' is not defined in module 'Main'

[Configuration]

Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted by GHC version 6.10.4

도움이 되었습니까?

해결책

You should define your type in a module, and then compile it:

module Test where
data FooBar = Foo | Bar

By invoking ghc -c foo_bar.hs, the object file foo_bar.o will be generated without having to define main.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top