On Thu, May 31, 2012 at 3:48 PM, Stan Kulp <stan_kulp@yahoo.com> wrote:
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  

...but when I try to execute it in GHCi I get the following error...

<interactive>:1:1: Not in scope: `lucky'

What am I missing?

ghci is intended for interactive evaluation; it doesn't (currently; this might change in future versions) do declarations the same way you would in a source file.

You can still do them with do-style let binding:

    Prelude> let lucky :: (Integral a_ => a -> String; lucky = ...

(This all has to fit on a single line unless you use braces and have done ":set +m"; this may also require a recent GHC.)

--
brandon s allbery                                      allbery.b@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms