[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] ghc -e

Subject: Re: [Haskell-cafe] ghc -e
From: Reid Barton
Date: Wed, 6 Jan 2010 21:15:11 -0500
On Thu, Jan 07, 2010 at 10:23:35AM +1000, Tony Morris wrote:
> Can I import a module when using ghc -e?
> e.g. ghc -e "import Control.Monad; forM [[1,2,3]] reverse"

One option is to create a file "imports.hs" which contains the text
"import Control.Monad", and then run

ghc -e "forM [[1,2,3]] reverse" imports.hs

I use this method in a short shell script "interact" so that I can
apply Haskell functions to files from the command line and don't have
to type the full qualified names of things in modules I use frequently.

Reid Barton
Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>