
On Fri, 2009-04-24 at 12:56 +0200, Philip K.F. Hölzenspies wrote:
Dear GHCers,
I am trying to write a wrapper library for lab work to give to students. My problem is, that the libraries I use require initialization that I really want to hide from our students. The wrapper I'm writing is compiled to a static library and installed with cabal, so students can just "ghc --make" or "ghci" their sources. Here comes the problem: I want to define main and let students just define labMain as an entry point to their program.
How can I have my library use "labMain" without a definition? Keep in mind that I want to give them a cabalized library that they can just link to, so I can't give them a template file that they fill and compile together with my code. Is it at all possible to have "external" functions and letting the linker sort stuff out?
When I've set practicals like this I've just provided them with a 3 line Main module that imports functions exported by the module(s) that the students write. Eg I have them fill in Draw.lhs but tell them to compile the thing using ghc --make Main.hs. I never found that this confused any of them (indeed some were interested in looking at the code). Duncan