emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Unhealthy Haskell babel
Date: Wed, 9 Dec 2020 21:20:42 -0600	[thread overview]
Message-ID: <CAFAhFSX1GCEQAAv1eE88MmN7dpRoXtR=xAPAGLqBytZHEm90kw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

I'm looking into Haskell (latest ghci) again on org-mode. This

#+begin_src haskell :results verbatim :exports both
:set +m
doubleSmallNumber x = if x > 100
  then x
  else x*2
#+end_src

works, but still the :set +m is necessary for it to see the whole. But this

#+begin_src haskell :results verbatim :exports both
:set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
#+end_src

results in this on the REPL side:

Prelude> :set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
"org-babel-haskell-eoe"
Prelude>
<interactive>:26:1-23: error:
    • No instance for (Show (Int -> Int)) arising from a use of ‘print’
        (maybe you haven't applied a function to enough arguments?)
    • In a stmt of an interactive GHCi command: print it
Prelude> Prelude> Prelude> "org-babel-haskell-eoe"

which is the same behavior if I try to feed the program into the REPL one
line at a time, i.e.,

Prelude> factorial :: Int -> Int

<interactive>:40:1-23: error:
    • No instance for (Show (Int -> Int)) arising from a use of ‘print’
        (maybe you haven't applied a function to enough arguments?)
    • In a stmt of an interactive GHCi command: print it

So the :set +m trick (take multiple lines) doesn't help here. Obviously,
Haskell is not ready to be used with Babel. Can it be fixed? BTW, this does
work with the regular ghci REPL and haskell-mode. If it helps, Standard ML,
which has very similar syntax (it was Haskell's parent), works fine.

LB

[-- Attachment #2: Type: text/html, Size: 1964 bytes --]

             reply	other threads:[~2020-12-10  3:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  3:20 Lawrence Bottorff [this message]
2020-12-10 10:27 ` Immanuel Litzroth
2020-12-10 17:21   ` Lawrence Bottorff
2020-12-10 18:40     ` Immanuel Litzroth
2020-12-10 20:26       ` Lawrence Bottorff
2020-12-14 20:45 ` Bastien

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFAhFSX1GCEQAAv1eE88MmN7dpRoXtR=xAPAGLqBytZHEm90kw@mail.gmail.com' \
    --to=borgauf@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Unhealthy Haskell babel' \
    /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

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).