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.
Haskell-Cafe mailing list