[Haskell-cafe] Information given by :info (Was: Some randomnewbie questions)

Simon Marlow simonmar at microsoft.com
Tue Jan 11 07:21:35 EST 2005

On 10 January 2005 10:26, Sebastian Sylvan wrote:

> On Mon, 10 Jan 2005 10:30:46 +0100 (MEZ), Henning Thielemann
> <iakd0 at clusterf.urz.uni-halle.de> wrote:
>> What I also would like to see is the Haddock documentation
>> string of a function printed by ":info" or some other command.
> Now _that_ would be truly useful.

It's not perfect, but it's better than nothing:

:def doc (\s -> let (rvar,rmod) = break (=='.') (reverse s); var =
reverse rvar in System.Cmd.system ("mozilla
http://www.haskell.org/ghc/docs/latest/html/libraries/base/" ++ reverse
rmod ++ "html#" ++ (if (Data.Char.isUpper (head var)) then "t:" else
"v:") ++ var) >> return "")


Prelude> :doc Prelude.head

You have to use a qualified name, it only works in package base, and you
can't look up data constructors.  Any hackers out there want to try
lifting these restrictions?


More information about the Haskell-Cafe mailing list