[Haskell-cafe] Re: Flymake Haskell

2007-11-14 Thread Daisuke IKEGAMI
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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Flymake Haskell

2007-11-10 Thread Daisuke IKEGAMI
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

Stefan wrote:
 I looked at http://www.emacswiki.org/cgi-bin/emacs/FlymakeHaskell
 but it's not clear what's going on.

I've been written the instruction of Flymake Haskell for both Emacs21 
and Emacs22 at;
  http://www.emacswiki.org/cgi-bin/emacs/FlymakeHaskell

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

I'm not a native English speaker. Please fix typo or inappropriate 
expressions. I wish it helps to write Haskell code on Emacs.

Best wishes,
ike
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Flymake Haskell

2007-11-08 Thread Daisuke IKEGAMI
Hi,

Thanks Thomas for your advice. The speed is improved very much.

The latest code about Flymake Haskell will be developed and discussed
on EmacsWiki:FlymakeHaskell.
  http://www.emacswiki.org/cgi-bin/emacs/FlymakeHaskell

However, we can continue the discussion via email, too.

Thomas wrote:
   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.

You are right; the multi-line pattern matching is needed. However, 
I failed some tries, and finally I invoked ghci from Emacs as I did usually.
Anyone helps? I don't know shim's work.

Gwern wrote:
   Is there further setup needed?

I think your setting maybe wrong.

   (defun flymake-Haskell-init ()
 (interactive)  ; this line should be removed
 brabra

I didn't test Gwern's setting on XEmacs, however I wish it helps.

Best wishes,
Ike
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Flymake Haskell

2007-11-07 Thread Daisuke IKEGAMI
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)
  - error and warning seems not distinguished
  (we may have to modify 'flymake-err-line-patterns')
Any comment is appreciated.

Best regards,
Ike

P.S.
I like vi-clone, such as vim, too. ;-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe