
Hello, I'm wondering if anyone's had success using Haskell in "Babel", the literate programming system in Emacs's Org Mode? I'm trying it with a blog post, but am getting mixed results. For those who don't know, Org Mode is an Emacs mode for editing text files, which has a bunch of features controlled by markup in the file. Babel is a feature which allows source code in various languages to be included in-line and executed. For example, I can write some Haskell like this: #+begin_src haskell [1..10] #+end_src Cheers, Chris

Apologies for the incomplete email, the Gnus "send mail" keybinding is the same as Org mode's "evaluate code"! I was wondering if anyone has had success with using Haskell in Org mode. I'm writing a blog post, where I can include a code block like the following and Org mode will print the result underneath: #+begin_src haskell [1..10] #+end_src #+RESULTS: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | By default, "haskell" code blocks will be sent to GHCi, which means I can't do top-level definitions: #+begin_src haskell :results value true x y = x false x y = y if_ c t e = c t e #+end_src #+RESULTS: : <interactive>:187:11: parse error on input `=' This can be worked around, but it's a little ugly and the "inferior Haskell" comint mode doesn't strip the intermediate prompts properly: #+begin_src haskell :prologue ":set +m" :results value both let {true x y = x; false x y = y; if_ c t e = c t e} in if_ true "then" "else" #+end_src #+RESULTS: : *Main| *Main| "then" I've tried saving code to a separate file, which Org mode calls "tangling": #+begin_src haskell :tangle yes true x y = x false x y = y if_ c t e = c t e #+end_src Then loading the code from the GHCi prompt: #+begin_src haskell :results value both :load test.hs if_ true "then" "else" #+end_src However it seems to be a bit hit-and-miss whether this will load the code. How do others do this, if at all? Cheers, Chris
participants (1)
-
Chris Warburton