[Haskell-cafe] Information given by :info (Was: Some randomnewbie
questions)
John Velman
velman at cox.net
Tue Jan 11 14:25:00 EST 2005
On Tue, Jan 11, 2005 at 12:21:35PM -0000, Simon Marlow wrote:
> 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.
SWI Prolog has a predicate, "apropos" of arity 1. When appropos(xxx) is
invoked from the interactive console (which is comparable to the HUGS of
GHCi console), a new process is started in a window. The window has two
panes one with a table of contents tree for the manual, one with brief
descriptions of the predicate xxx. There is also an entry box for a new
search, and a menu.
It seems that it wouldn't be too hard to put together something similar
that would work from either the HUGS or GHCi console. It would be too
large a project of me at the moment :-).
SWI Prolog uses XPCE, which is distributed with SWI Prolog, for the GUI.
Best,
John Velman
> >>
> >
> > 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 "")
>
> eg.
>
> 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?
>
> Cheers,
> Simon
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list