我有两个Haskell文件,一个是SimpleJSON.hs,另一个是Main.hs。
--File: SimpleJSON.hs
module SimpleJSON
(
JValue (..)
,getString
,getInt
,getDouble
,getBool
,getObject
,getArray
,isNull
) where
data JValue = JString String
| JNumber Double
| JBool Bool
| JNull
| JObject [(String, JValue)]
| JArray [JValue]
deriving (Eq, Ord, Show)
And
--File: Main.hs
module Main () where
import SimpleJSON
main = print (JObject [("foo", JNumber 1), ("bar", JBool False)])
因此,在编译时我会执行以下操作:
ghc -c SimpleJSON.hs
并且
ghc simple Main.hs SimpleJSON.o
然后我遇到了错误,错误信息如下:
Main.hs:1:1: error:
The IO action ‘main’ is not exported by module ‘Main’
|
1 | module Main () where
| ^
如何解决这个编译错误?