Haskell Programming Environment

Hans Wolfgang Loidl hwloidl@cee.hw.ac.uk
Wed, 25 Oct 2000 18:02:47 +0100


>  > On Wed, Oct 25, 2000 at 09:03:43AM -0700, Doug Ransom wrote:
>  > > I would like to be able to inspect the type of things easily by hovering my
>  > > mouse over an expression.  As a beginner, I find it hard sometimes to get
>  > > types correct in Haskell since often variables are not declared as a
>  > > specific type.  
>  > 
>  > Since you are typically dealing with incomplete programs in an editor
>  > this is really tough.  The PSG system was able to generate such
>  > editors and I once saw it for the purely functional language Sample in
>  > action:  you could mark any term with the mouse cursor and ask for its
>  > type. 

>  One of the emacs modes for Haskell gives the type of the identifier
>  the cursor is in in the modeline.  It does this by examining the type
>  signatures in the current file, and having the prelude type signatures
>  built-in.  This is quite helpful, if incomplete, and fairly easy to
>  implement.

To increase its usefulness for multi-module programs, I have been planning
for a long time to extract type info out of .hi files and feed it into the
haskell-doc emacs module. Well, one day I may write an elisp parser to do
that. In the meantime there is of course the possibility of pre-processing
the Haskell source (or .hi) and feeding the type info as an elisp
expression directly to haskell-doc. Here is the relevant bit from the docu:

;; If you want to define your own strings for some identifiers define an
;; alist of (ID . STRING) and set `haskell-doc-show-user-defined' to t. 
;; E.g:
;;   (setq haskell-doc-show-user-defined t)
;;   (setq haskell-doc-user-defined-ids 
;;	(list 
;;	   '("main" . "just another pathetic main function")
;;	   '("foo" . "a very dummy name")
;;	   '("bar" . "another dummy name")))

Hope that helps,
  Hans Wolfgang