[Haskell-cafe] Re: Flymake Haskell

Daisuke IKEGAMI ikegami at madscientist.jp
Thu Nov 15 00:56:32 EST 2007


Dear Stefan and Haskell-Cafe,

Thanks to keeping your interest to the flymake-mode for Haskell.

Stefan wrote:
> Could you explain to me what flycheck_haskell.pl does, and give an
> example of a problematic situation solved by the use of
> flycheck_haskell.pl. 

Sure. 

The perl script flycheck_haskell.pl, which is presented at EmacsWiki,
  http://www.emacswiki.org/cgi-bin/emacs/FlymakeHaskell
edits the warning and error messages as an one line from the output of
ghc.

Now I'll describe how to solve the perl script the problem for using
the flymake-mode with ghc.

Here is an example of an error message by ghc.

Foo.hs:4:4:
    No instance for (Num Char)
      arising from the literal `0' at Foo.hs:4:4
    Possible fix: add an instance declaration for (Num Char)
    In the expression: 0
    In the definition of `i': i = 0

where the Foo.hs has an explicit error as follows:

----
module Foo where

i :: Char -- a type error here
i = 0
----

The perl script removes newlines and white spaces from the
error message from ghc and then print it as follows (long one line):

Foo.hs:4:4: No instance for (Num Char) arising from the literal `0'... 

The reason why I needed the perl script is that the current
flymake-mode assumes that the syntax checker must print warning/error
messages as an 'one' line for each and the message must have the
following information:
  - filename    (required)
  - line number (required)
  - column number (optional)
  - warning/error message (required)
The above requirement is the problem when we meet to use
flymake-mode with ghc alone. 

If you want to know the detail about the original flymake-mode, please
read the definition of two functions
  - 'flymake-parse-err-lines
  - 'flymake-parse-line
instead of asking me more further. I'm a pragmatic programmer who
knows a few about EmacsLisp and can't explain the flymake-mode clearly.
However, I greatly appreciate any discussion about the flymake-mode
for Haskell here.

> > Note that it will not work in the future, since the flymake-mode
> > has been developed so actively.
> Huh?  Where? 

I forgot to write the following sentence in the previous email:

  the flymake-mode has been developed so actively at
  not the official site http://flymake.sourceforge.net/
  but 
  http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/progmodes/flymake.el

The latest changes had done on 2 weeks and 4 days ago.

I would like to thank Don Stewart for his kindly comments on IRC
and that he introduced Flymake Emacs at the latest Haskell news.
Gwern Branwen helps me a lot and add a section about Flymake Haskell
to the Haskell wiki.
  http://haskell.org/haskellwiki/Haskell_mode_for_Emacs
I would like to thank also anonymous reviewers on EmacsWiki.

Best wishes,
ike


More information about the Haskell-Cafe mailing list