
Hi all, I'm starting to learn haskell by my own, being currently mostly a Common Lisp, Scheme, C++ programmer... I've got the haskell emacs mode but can't find a manual. Moreover, I've found some keybindings on the net but nothing that allows me to start an interpreter in emacs and send definitions, one by one to the interpreter. Is this possible? Is there any good reference of the emacs keybindings for haskell mode? Cheers, -- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK

On 6 aug 2007, at 22.11, Paulo J. Matos wrote:
Hi all,
I'm starting to learn haskell by my own, being currently mostly a Common Lisp, Scheme, C++ programmer... I've got the haskell emacs mode but can't find a manual. Moreover, I've found some keybindings on the net but nothing that allows me to start an interpreter in emacs and send definitions, one by one to the interpreter. Is this possible? Is there any good reference of the emacs keybindings for haskell mode?
If you're used to Slime+Paredit, then there isn't something really comparable, but you get some basic interactive programming with the standard key-bindings: C-c C-b ... when pressed for the first time this will start an interpreter (ghci or hugs most of the time), when pressed with a running interpreter it'll switch to that buffer. C-c C-l ... Load the current file into the editor. There is no function-wise compilation. With the latest Haskell mode, you get clickable error messages, too. Then there is shim[1], which is a start of a Slime-like emacs mode, it can: - compile and show compile errors directly in the source (C-c C-k) - insert the type of a function (C-c C-t) The big problem with shim is, that it is only really useful as long as your code compiles. To have anything more useful you need to have good (incremental) parsing facilities, which Emacs isn't particularly good at. Every once in a while I do some hacking towards this goal, but it's rather low-priority (and I'm no particular Emacs guru either, though with (require 'cl) it get's somewhat more fun.) Many Haskell hackers also prefer Vim, so that doesn't help, either ;) Oh, and there's hoogle.el, which is pretty similar to Hyperspec lookup (actually, I think it's better; more like Lisp-doc lookup). Regards, / Thomas [1] .. http://shim.haskellco.de/trac/shim

C-c C-b ... when pressed for the first time this will start an interpreter (ghci or hugs most of the time), when pressed with a running interpreter it'll switch to that buffer.
C-c C-l ... Load the current file into the editor. There is no function-wise compilation.
Don't forget C-c C-r to reload the file in the buffer. To the OP: Here's the page I used when I set up emacs for haskell the other week: http://haskell.org/haskellwiki/Haskell_mode_for_Emacs

C-c C-b ... when pressed for the first time this will start an interpreter (ghci or hugs most of the time), when pressed with a running interpreter it'll switch to that buffer.
C-c C-l ... Load the current file into the editor. There is no function-wise compilation.
More generally, in Emacs "C-h m" will give you a list of keybindings for the current major mode. Also many major modes offer a menu in the menu-bar where the main special features are advertized.
Don't forget C-c C-r to reload the file in the buffer.
I've removed it from the next release of haskell-mode, so if you need it, please explain why. Stefan

I've removed it from the next release of haskell-mode, so if you need it, please explain why.
So C-c C-l is the preferred method for re-loading?
Yes.
I don't know enough about the details to know if :l and :r do exactly the same things in ghci.
I don't either. But experimentation suggests that the only difference is that :r doesn't need an argument (which in the case of haskell-mode doesn't make any difference since the arg is provided by haskell-mode anyway). Stefan

On Wed, Aug 08, 2007 at 12:57:51PM -0400, Stefan Monnier wrote:
I've removed it from the next release of haskell-mode, so if you need it, please explain why.
So C-c C-l is the preferred method for re-loading?
Yes.
I don't know enough about the details to know if :l and :r do exactly the same things in ghci.
I don't either. But experimentation suggests that the only difference is that :r doesn't need an argument (which in the case of haskell-mode doesn't make any difference since the arg is provided by haskell-mode anyway).
:r is also *much* faster in general; :l reloads all modules from scratch, while :r only reloads the modules that have changed. Stefan

Hello,
:r is also *much* faster in general; :l reloads all modules from scratch, while :r only reloads the modules that have changed.
:r also doesn't seem check the import declarations for changes. For example, if I add a new import statement to my file, without adding code which uses the new import, :r will not cause the newly imported things to be in scope, but :l will. BTW this is for GHCi 6.6.1, though I think older versions had the same behavior. -Jeff --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

I don't know enough about the details to know if :l and :r do exactly the same things in ghci.
SM> I don't either. But experimentation suggests that the only SM> difference is that :r doesn't need an argument (which in the case SM> of haskell-mode doesn't make any difference since the arg is SM> provided by haskell-mode anyway). But sometimes it's not the right argument if you have several haskell source files opened. I don't find C-c C-r to be of much use, but it's useful sometimes.

Thomas Schilling wrote:
On 6 aug 2007, at 22.11, Paulo J. Matos wrote: If you're used to Slime+Paredit, then there isn't something really comparable, but you get some basic interactive programming with the standard key-bindings:
(But paredit does work in haskell-mode, and I find it useful...) Jules

Thank you all for your references and tips, I'll be using them. :-)
On 06/08/2007, Jules Bean
Thomas Schilling wrote:
On 6 aug 2007, at 22.11, Paulo J. Matos wrote: If you're used to Slime+Paredit, then there isn't something really comparable, but you get some basic interactive programming with the standard key-bindings:
(But paredit does work in haskell-mode, and I find it useful...)
Jules
-- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK
participants (8)
-
Andrew Wagner
-
Jeff Polakow
-
Jules Bean
-
Miguel Mitrofanov
-
Paulo J. Matos
-
Stefan Monnier
-
Stefan O'Rear
-
Thomas Schilling