Interface Files _ HOWTO?

Ingo Sander
Fri, 20 Oct 2000 18:09:04 +0200 (MET DST)

After working a lot with Hugs I tried to compile my Haskell code with GHC.
But it does not work, I am not able to figure out how to work with the
interface files (.hi). My program is build out of several modules, like
this (much simpler, but facing the same problem...)

File MyList.hs

module MyList(MkList(Empty, (:-))) where

infixr 5 :-

data MkList a =   Empty
		| a :- (MkList a) deriving (Eq, Show)

File ListFun.hs

module ListFun(mapL) where

import MyList

mapL f Empty   = Empty
mapL f (x:-xs) = f x :- mapL f xs

File ListLib

module ListLib(module MyList, module ListFun) where

import MyList
import ListFun

File Main.hs

module Main(main) where

import ListLib

main = putStr (show (mapL (+1) (1:-2:-Empty)))

As I said the code works with hugs, and I want to have the hierarchy in
the library structure.

So, how do I compile this in GHC? I hoped, that it would be enough to
compile all files with the -c option (generating .hi and .o files) and
then compiling Main.hs to get an executable program. Howeve, I get the

> ghc Main.hs
ghc: module version unchanged at 7
Undefined                       first referenced
 symbol                             in file
MyList_ZCzm_con_info                Main.o
MyList_zdfShowMkList_closure        Main.o
ListFun_mapL_closure                Main.o
MyList_Empty_static_closure         Main.o
ld: fatal: Symbol referencing errors. No output written to a.out

So, what's wrong, and am I totally on the wrong track... (I studied the
GHC User Guide, but could not find the answer to my problem).

Thanks in advance!

Ingo Sander