From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Haskell org-mode problems redux
Date: Thu, 30 May 2019 12:55:42 -0500 [thread overview]
Message-ID: <CAFAhFSXDn9y1Bh3C86UX23ea0_FRGzKQ+R+r3r=WsNFwqoptZw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]
I've been trying to get Haskell to work in babel code blocks for a long
time. A year or so ago I tried and eventually gave up. I tried again
recently . . . same old problems, i.e., the code block is evaluated
exclusively by the ghci REPL, which doesn't understand or play well with an
org babel code block.
Before, the recipe was to add `:set +m` to either the top of the block or
run it in the REPL to allow "multiple lines" declarations, e.g., functions.
Then there was the `let` in front of a function declaration, which is also
a REPL workaround. Now it seems you need the :{ ... :} trick to get all the
code block lines to be seen as together, i.e.,
#+begin_src haskell :results raw
:{
doubleSmallNumber x =
if x > 10
then x
else x * 2
:}
#+end_src
otherwise the block is treated as though it is being fed into the REPL one
at a time with no idea these lines are together making a function
declaration. I'm on latest org, have installed Haskell stack 8.6.3 on
Ubuntu (Haskell stack 8.6.5 on Windows). The maddening thing is the
intermittent behavior, i.e., sometimes it likes what you're doing:
#+begin_src haskell :results raw
tripleMe x = x + x + x
#+end_src
and
#+begin_src haskell :results raw
[x | x <- [0..100], x `mod` 2 == 0 && x `mod` 7 == 0]
#+end_src
#+RESULTS:
Prelude> [0,14,28,42,56,70,84,98]
[0,14,28,42,56,70,84,98]
work fine -- but often enough when trying to declare a function with type
declaration first I get cryptic errors -- which are then solved with the :{
... :} REPL kludge. One other oddness is starting a ghci session with babel
creates a different sort of REPL than just starting one with haskell-mode .
. . and the two REPLs seem to clash and not like each other around.
Declaring :session *haskell* doesn't seem to matter. . . .
I was in touch with Rob Moss who claims to have it all working with GHC 4.4
from Debian and spacemacs, but when I tried all that I wasn't able to
reproduce his results, rather, the same old problems.
Soooo, any ideas? It seems like ob-haskell -- which is now built in, not
separate? -- needs some attention. Or somebody who has the proverbial
silver bullet comes forth to save the day.
LB
[-- Attachment #2: Type: text/html, Size: 2548 bytes --]
next reply other threads:[~2019-05-30 17:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 17:55 Lawrence Bottorff [this message]
2019-05-30 21:25 ` Haskell org-mode problems redux Bruno Barbier
2019-05-31 3:40 ` Lawrence Bottorff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFAhFSXDn9y1Bh3C86UX23ea0_FRGzKQ+R+r3r=WsNFwqoptZw@mail.gmail.com' \
--to=borgauf@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.