[Haskell-cafe] A type class puzzle
Greg Buchholz
haskell at sleepingsquirrel.org
Tue Oct 31 16:54:48 EST 2006
Arie Peterson wrote:
] I'm not sure I'm getting your point, but this is just because in the
] second instance, the second parameter of BuildList is 'a -> r', so the
] specific type of 'build\'' is '[a] -> a -> (a -> r)' which is just '[a] ->
] a -> a -> r' (currying at work).
I guess it just looks really strange to my eyes. For example, "foo"
and "bar" are legal, but "baz" isn't. That's what I was thinking of the
situation, but I guess the type classes iron out the differences.
> foo :: Int -> Int -> Int -> Int
> foo 0 = (+)
>
> bar :: Int -> Int -> Int -> Int
> bar 1 x = succ
>
> baz :: Int -> Int -> Int -> Int
> baz 0 = (+)
> baz 1 x = succ
Greg Buchholz
More information about the Haskell-Cafe
mailing list