RE: Interface Files _ HOWTO?

2000-10-23 Thread Simon Peyton-Jones

Compile the module from bottom to top, with -c.  Then link.  THus

ghc -c MyList.hs
ghc -c ListFun.hs
...etc...
ghc -c Main.hs
ghc -o MyApp MyList.o ListFun.o ... Main.o

Simon

| -Original Message-
| From: Ingo Sander [mailto:[EMAIL PROTECTED]]
| Sent: 20 October 2000 17:09
| To: [EMAIL PROTECTED]
| Subject: Interface Files _ HOWTO?
| 
| 
| 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
| following:
| 
|  ghc Main.hs
| ghc: module version unchanged at 7
| Undefined   first referenced
|  symbol in file
| MyList_ZCzm_con_infoMain.o
| MyList_zdfShowMkList_closureMain.o
| ListFun_mapL_closureMain.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
| 
| 
| 
| ___
| Glasgow-haskell-users mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
| 

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Overloaded function and implicit parameter passing

2000-10-23 Thread Fergus Henderson

On 23-Oct-2000, José Romildo Malaquias [EMAIL PROTECTED] wrote:
 - cut here
 module Main where
 
 class C a where
 f :: (?env :: Integer) = a - Integer
 
 instance C Integer where
 f x = ?env + x
 
 main = putStrLn (show (f (45::Integer) with ?env = 100))
 - cut here
...
 $ ghc -fglasgow-exts Test1.hs -o test1
 
 Test1.hs:7:
 Unbound implicit parameter `env_rJX :: Integer'
 arising from use of `env_rJX' at Test1.hs:7
...
 Would anybody comment on what is going on with GHC?

That sure looks to me like a bug in GHC's support for implicit
parameter passing.

-- 
Fergus Henderson [EMAIL PROTECTED]  |  "I have always known that the pursuit
|  of excellence is a lethal habit"
WWW: http://www.cs.mu.oz.au/~fjh  | -- the last words of T. S. Garp.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users