[Haskell-cafe] ghci *.hs

Henk-Jan van Tuyl hjgtuyl at chello.nl
Thu Apr 9 16:12:34 EDT 2009

On Thu, 09 Apr 2009 15:44:42 +0200, Paul Keir <pkeir at dcs.gla.ac.uk> wrote:

> Hi all,
> I like to use ghci *.hs to start my session, but I then have to type :m  
> +Main
> to bring the Main module into scope. Is there a command-line switch to  
> control
> which modules are initially in scope with ghci?
> Thanks,
> Paul

You only have load the main module like this:
   ghci Main.lhs

(the name doesn't have to be Main.lhs or Main.hs), the rest follows  
automatically, provided the imported modules start with a line like:

> module ImportModule2 where

It is also possible to run the program immediately with the command:
   runhaskell Main.lhs

Henk-Jan van Tuyl


More information about the Haskell-Cafe mailing list