[Haskell-cafe] Bug in "Haskell for C programmers" tutorial?

Erik de Castro Lopo hc-erikd at mega-nerd.com
Sat Dec 31 18:04:38 EST 2005

Hi all,

I'm working through the "Haskell for C programmers" tutorial
and in this section":


it has:

    fib :: Num a, Num b => a -> b
    fib n = fibGen 0 1 n

    fibGen :: Num a, Num b => b -> b -> a -> b
    fibGen a b n = case n of
        0 -> a
        n -> fibGen b (a + b) (n - 1)

which doesn't work with GHC, but it does if I add parentheses 
around both instances of "Num a, Num b".

Is this a bug in the tutorial or is there another explanation?

  Erik de Castro Lopo
"Anyone who considers arithmetical methods of producing random
digits is, of course, in a state of sin." - John Von Neumann (1951)

More information about the Haskell-Cafe mailing list