
31 Oct
2006
31 Oct
'06
5:18 p.m.
Greg Buchholz wrote:
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
This could be understood as a weakness in the de-sugaring of pattern-matching, because bong :: Int -> Int -> Int -> Int bong 0 = (+) bong 1 = \x -> succ is just fine. Jacques