I have two haskell files named SimpleJSON.hs and another is 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)])
So while compiling I am doing
ghc -c SimpleJSON.hs
and
ghc simple Main.hs SimpleJSON.o
Then I am getting error as
Main.hs:1:1: error:
The IO action ‘main’ is not exported by module ‘Main’
  |
1 | module Main () where
  | ^
How to resolve this compilation error?
Should be
module Main where
or
module Main (main) where
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With