
I just tried here, and got no problems.
lucky.hs:
lucky :: (Integral a) => a -> String
lucky 7 = "LUCKY NUMBER SEVEN!!!"
lucky x = "Sorry, you're out of luck, pal..."
ghci:
:load "/path/to/lucky.hs"
[1 of 1] Compiling Main ( /path/to/lucky.hs, interpreted )
Ok, modules loaded: Main.
*Main> lucky 7
"LUCKY NUMBER SEVEN!!!"
*Main> lucky 200
"Sorry, you're out of luck, pal..."
*Main>
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
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"
Stan Kulp
writes: 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@haskell.org http://www.haskell.org/mailman/listinfo/beginners