[Haskell-cafe] Re: Run haskell program in emacs without typing
"main" in the ghci buffer.
Jose A. Ortega Ruiz
jao at gnu.org
Mon Apr 26 22:06:21 EDT 2010
Zura_ <xyz at gol.ge> writes:
> Hello,
>
> Is it possible to run haskell program in emacs without typing "main" in the
> ghci buffer? Assuming "main" function exists of course.
> Or, maybe automate sending "main\n" string to ghci buffer input.
> In other words, I want edit/run/see result style session.
Assuming you're using haskell-mode, does
M-x inferior-haskell-load-and-run
do what you want? You can of course define a shortcut for it:
(define-key haskell-mode-map "\C-l" 'inferior-haskell-load-and-run)
If you don't want to load the file, just run main:
(defun haskell-main ()
(interactive)
(inferior-haskell-send-command (inferior-haskell-process)
":main"))
(This a very simple version; there're many possible variations; for
instance, adding (swith-to-haskell) at the end).
HTH,
jao
More information about the Haskell-Cafe
mailing list