[Haskell-beginners] Help in pattern matching

Magnus Therning magnus at therning.org
Mon Mar 8 05:26:46 EST 2010

On Mon, Mar 8, 2010 at 10:21, Magnus Therning <magnus at therning.org> wrote:
> As was suggested by Jonas, it might be worth exploring a tuple of two
> Either instead.

AFAICS the following would be equivalent to your code:

type TestData2 = (Either String Int, Either String Int)
test2 (x@(Right _), _) = x
test2 (Left _, y) = y


Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

More information about the Beginners mailing list