ghci's :def takes a 'String -> IO String' and converts it into a ghci command.
this makes it possible to pass a command parameter to a haskell function, and to interpret the result of the call as a ghci command.

that is nice, but how do i get access to the command's output? that is, i'd like to run a ghci command, and capture its ouput as a haskell String, eg, to pass it on to another ghci command, or to a haskell function.

perhaps something simple, like an additional ghci top-level binding:

   GHCi.cmd :: String -> IO String

so that i could write things like

   let doSomething output = ..
   :def mymodules \_->GHCi.cmd ":show modules" >>= doSomething

or a way to compose ghci commands, so that i could write

   :def doSomething \output->..
   :def mymodules \_->return ":show modules :>>= :doSomething"

would that be difficult to provide?

claus

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to