
If I simply put a type declaration into the GHCi (version 8.8.4), it complains: 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) :} #+end_src #+begin_src haskell :results verbatim :exports both factorial 0 #+end_src #+RESULTS: : 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

Il 10 dicembre 2020 alle 14:53 Lawrence Bottorff ha scritto:
If I simply put a type declaration into the GHCi (version 8.8.4), it complains:
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.
I do not believe it solves your problem but λ> prova :: Int; prova = 8 λ> works —F

Yes, but a simple
λ> prova :: Int
doesn't work. What am I missing?
On Thu, Dec 10, 2020 at 3:11 PM Francesco Ariis
Il 10 dicembre 2020 alle 14:53 Lawrence Bottorff ha scritto:
If I simply put a type declaration into the GHCi (version 8.8.4), it complains:
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.
I do not believe it solves your problem but
λ> prova :: Int; prova = 8 λ>
works —F _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

Il 10 dicembre 2020 alle 15:41 Lawrence Bottorff ha scritto:
Yes, but a simple
λ> prova :: Int
doesn't work. What am I missing?
No idea the reason why ghci does not accept it, maybe because if it did there would be a bodyless signature in scope? Also maybe this is slightly more palatable for you: λ> :set +m λ> let prova :: Int -> String prova = show [blank line] λ> prova 7 "7"
participants (2)
-
Francesco Ariis
-
Lawrence Bottorff