[Haskell-beginners] GHCi won't allow type declaration as shown in LYAHFGG

Homero Cardoso de Almeida homerocda at gmail.com
Fri Jun 1 00:45:56 CEST 2012

I just tried here, and got no problems.

lucky :: (Integral a) => a -> String
lucky 7 = "LUCKY NUMBER SEVEN!!!"
lucky x = "Sorry, you're out of luck, pal..."

:load "/path/to/lucky.hs"
[1 of 1] Compiling Main             ( /path/to/lucky.hs, interpreted )
Ok, modules loaded: Main.
*Main> lucky 7
*Main> lucky 200
"Sorry, you're out of luck, pal..."

I would suggest verifying my ghc installation or for any "funky" chars in
the file.

Homero Cardoso de Almeida

On Thu, May 31, 2012 at 6:16 PM, Keshav Kini <keshav.kini at gmail.com> wrote:

> Stan Kulp <stan_kulp at yahoo.com> writes:
> > I have been working my way through "Learn You a Haskell for Greater
> Good" and
> > am stumped when I get to the "Syntax in Functions - Pattern Matching"
> section.
> >
> > The book shows the following expression...
> >
> > ghci> lucky :: (Integral a) => a -> String
> As far as I can see, the live version of `the section you mention`_ on
> learnyouahaskell.com does not contain this text - it doesn't have the
> "ghci> " at the beginning of the line. Besides what others have said in
> response to your question, I would add that you should make sure to read
> LYAH on the website if possible - other sources might be out of date, as
> I think the author does update the website version from time to time.
> .. _the section you mention:
>   http://learnyouahaskell.com/syntax-in-functions#pattern-matching
> -Keshav
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120531/97815794/attachment.htm>

More information about the Beginners mailing list