[Haskell-cafe] hacking ghci
Walter Moreira
gwallter at gmail.com
Mon Jan 8 01:21:26 EST 2007
Hi Haskellers. A short while ago I asked about the possibility to have
the output of ghci in color. Thanks to Donald Stewart who set up a
wiki page to continue the attempt. Other people suggested HsColour and
GUI's (thanks too). I'm not so interested in highlighting the snippets
of code which ghci displays, but to use different colors for the
different types of output: different colors for the prompt, input,
warnings, exceptions, normal output, etc.
Are any of these ideas viable?:
1. Hack the code of Interactive.hs in the GHC distribution and
substitute the calls to 'putStr[Ln]' by some thin wrapper which can
write with colors, according to a command line option (--color or
--colour, for example), maybe using HsColour. This looks easy
enough and I'd be willing to do it, but it's intrusive, and one has
to mantain a different version of ghci in parallel with the main
ghci.
2. Use GHC as library (from 6.6 on) and write a similar application as
ghci, with more emphasis in the 'interactive' part of the name (in
the same way as the relation between Python and the IPython
extended shell). This is more work and more duplicate efforts, but
it may be worthly, perhaps.
3. Write a wrapper which communicates with ghci via pipes. I read some
attempts about this somewhere, and people suggested an approach as
in #2.
I haven't mentioned the GUI applications, since I would like to just
have something in the spirit of ghci (command line oriented), but with
colors or with configurable output. Which approach do you people
think it is best?
Sorry for the long message. Cheers,
Walter
More information about the Haskell-Cafe
mailing list