[Haskell-cafe] Flymake Haskell

Thomas Schilling nominolo at googlemail.com
Thu Nov 8 07:44:34 EST 2007


On Thu, 2007-11-08 at 12:57 +0900, Daisuke IKEGAMI wrote:
> Hello emacsen users, 
> 
> Here is a setting to check your Haskell code /on-the-fly/ 
> with 'flymake-mode'.
> 
>   (require 'flymake)
>   
>   ;; flymake for Haskell
>   (defun flymake-Haskell-init ()
>     (flymake-simple-make-init-impl
>       'flymake-create-temp-with-folder-structure nil nil
>       buffer-file-name
>       'flymake-get-Haskell-cmdline))
>   (defun flymake-get-Haskell-cmdline (source base-dir)
>     (list "ghc" (list "--make" (concat "-i" base-dir) source)))
>   (push '(".+\\.hs$" flymake-Haskell-init)
>     flymake-allowed-file-name-masks)
>   (push '(".+\\.lhs$" flymake-Haskell-init)
>     flymake-allowed-file-name-masks)
>   (push '("^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): \\(.*\\)$" 1 2 3 4)
>     flymake-err-line-patterns)
> 
> The 'flymake-mode' has been developed at http://flymake.sourceforge.net/
> Emacs22 has this mode already.
> 
> dons recommends to me at IRC to write this code into the wiki, however, 
> I don't know where we should put the snippet.
> 
> You can watch a short demo at the following blog:
>   http://madscientist.jp/~ikegami/diary/20071108.html#p01
> 
> I have some complaints though it works:
>   - it's slow (hmm)

Try using:

(defun flymake-get-haskell-cmdline (source base-dir)
  `("ghc" ("--make" "-fno-code" ,(concat "-i" base-dir) ,source)))

This avoids any kind of code-generation, so only syntax and types are
checked.

>   - error and warning seems not distinguished
>       (we may have to modify 'flymake-err-line-patterns')
> Any comment is appreciated.

It seems you need multi-line pattern matching.  Note that shim already
can do this, but it doesn't do it automatically.  Unfortunately, shim
chokes on files that need pre-processing.  There's probably a way to
integrate these two.

> 
> Best regards,
> Ike
> 
> P.S.
> I like vi-clone, such as vim, too. ;-)
> _______________________________________________
> 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