Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Haskell REPL doesn't accept type declaration (Lawrence Bottorff)
2. Re: Haskell REPL doesn't accept type declaration
(Francesco Ariis)
3. Re: Haskell REPL doesn't accept type declaration
(Lawrence Bottorff)
4. Re: Haskell REPL doesn't accept type declaration
(Francesco Ariis)
5. (no subject) (M Douglas McIlroy)
----------------------------------------------------------------------
Message: 1
Date: Thu, 10 Dec 2020 14:53:51 -0600
From: Lawrence Bottorff <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Haskell REPL doesn't accept type
declaration
Message-ID:
<cafahfsw1vmm+xumplkbgsqq6e0td6eoev26e8csw7meld-u...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20201210/90ca6304/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 10 Dec 2020 22:09:35 +0100
From: Francesco Ariis <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Haskell REPL doesn't accept type
declaration
Message-ID: <20201210210935.GC851@extensa>
Content-Type: text/plain; charset=utf-8
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
------------------------------
Message: 3
Date: Thu, 10 Dec 2020 15:41:06 -0600
From: Lawrence Bottorff <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskell REPL doesn't accept type
declaration
Message-ID:
<cafahfswrdzqf41yfp5k2kqvhdckbidb5ayjp+xnx8vzeunw...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Yes, but a simple
λ> prova :: Int
doesn't work. What am I missing?
On Thu, Dec 10, 2020 at 3:11 PM Francesco Ariis <[email protected]> wrote:
> 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
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20201210/d1bf0d51/attachment-0001.html>
------------------------------
Message: 4
Date: Thu, 10 Dec 2020 23:08:08 +0100
From: Francesco Ariis <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Haskell REPL doesn't accept type
declaration
Message-ID: <20201210220808.GA30311@extensa>
Content-Type: text/plain; charset=utf-8
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"
------------------------------
Message: 5
Date: Thu, 10 Dec 2020 22:57:26 -0500
From: M Douglas McIlroy <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] (no subject)
Message-ID:
<cakh6piw_obirvt55mspcn_ye+hm2me5bam-k0inman+kqkl...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Is it possible to decorate a definition like this
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 149, Issue 4
*****************************************