I have these two modules:
module Server where
import Data.JSON.Schema.Generic (gSchema)
import Data.JSON.Schema.Types (JSONSchema(schema))
import Two
instance JSONSchema Data where
schema = gSchema
main :: IO ()
main = undefined
{-# LANGUAGE DeriveGeneric #-}
module Two where
import GHC.Generics (Generic)
data Data = Data {
scName :: String
} deriving Generic
When trying to build the project containing these two files, the ghc in linking phase throws several errors looking like this: (They only differ in the (.data+0XXXX) part).
dist/dist-sandbox-190abc84/build/libHSserver-0.1.a(Server.o):(.data+0x1b8): undefined reference to `serverzm0zi1_Two_zdfGenericData_closure'
And final message is:
collect2: error: ld returned 1 exit status
I tried this with ghc 7.8.3 and 7.6.3 and they both behave similarly.
I can make this functionality work if put all the code into one module.
Can anyone explain, what's happening here, please?
I'm using GHC 7.8.3 (from the Haskell Platform). Below is a
cabal.config
file with the specific versions used in the sandbox.