[Haskell-begin] invoking GHCi programtically ?

Krassimir Krustev krassimir.krustev at gmail.com
Fri Jul 18 05:12:59 EDT 2008

Is it possible to invoke GHCi from Haskell code?
I want to achieve the following effect:

have a shell script invoke
runhaskell myprog.hs < input.dat

and at some point (on conditions) have the prog bring me the ghci prompt


so I can examine my program state   interctively, for example place
breakpoints, run my functions piecewise?
and then do


and then have the prompt again (if conditions)

I did try

ghci myprog.hs < input.dat

Command-line arguments
ghci myprog.hs a b c
are similarly by ghci not acceptable

In the overall, I want to have the stdin redirected from file once in
the GHCi session, place breakpoints and do :step(s) with that stream
in this way

and cannot also do
Main>:main < input.dat
but in my case (I think) this not also an option since its not me but
the wrapper script doing the setup.


More information about the Beginners mailing list