[Haskell-beginners] Haskell REPL doesn't accept type declaration

Lawrence Bottorff borgauf at gmail.com
Thu Dec 10 20:53:51 UTC 2020

If I simply put a type declaration into the GHCi (version 8.8.4), it

Prelude> divides :: Integer -> Integer -> Bool
<interactive>:18:1-7: error:
    Variable not in scope: divides :: Integer -> Integer -> Bool

I'm trying to use Emacs org-mode babel, and I have to wrap the code block
to get it to work. For example:

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

#+begin_src haskell :results verbatim :exports both
factorial 0

: 1

I understand :set +m, but this doesn't help. Why won't a running Haskell
REPL with set +m take a type declaration?

Lawrence Bottorff
Grand Marais, MN, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20201210/90ca6304/attachment.html>

More information about the Beginners mailing list