Wenduan,
What I thought at first the signature of plus should be: plus :: (a ->
c, b -> d) -> Either a b -> Either c d?Anyone know where I was wrong?
Your initial thought was right: it should
(a -> c, b -> d) -> Either a b -> Either c d
Why didn't you just test it by feeding in to a compiler or interpreter;
these are really useful, you know. ;)
Besides...
case :: (a -> c,b -> c) -> Either a b -> c
case (f, g) (Left x) = f x
case (f, g) (Right x) = g x
You can't name your function case: it's a reserved word.
You might want to check out the standard libraries:
case' = uncurry either
HTH,
Stefan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe