Re: [Haskell-cafe] Either example

2013-02-07 Thread Harald Bögeholz
Am 07.02.13 03:37, schrieb Jacob Thomas: Hello I'm new to Haskell, and need help with figuring out the Either type... Any example to show how this works? Maybe a program I wrote a while ago can help you get it. https://github.com/ctbo/slitherlink In Slitherlink.hs there is a function

Re: [Haskell-cafe] Either example

2013-02-07 Thread mukesh tiwari
Hi Jocob I would recommend you to go through the LYH ( http://learnyouahaskell.com/making-our-own-types-and-typeclasses ) . data Either a b = Left a | Right b deriving (Eq, Ord, Read, Show) Lets say you have a division function and you want to avoid division by zero so this simple function

[Haskell-cafe] Either example

2013-02-06 Thread Jacob Thomas
Hello I'm new to Haskell, and need help with figuring out the Either type... Any example to show how this works? Jacob ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Either example

2013-02-06 Thread Alvaro Gutierrez
Often, Either is used to represent, exclusively, a value or a failure, in a more detailed way than Maybe can. For example, a function like `parse` ( http://hackage.haskell.org/packages/archive/parsec/latest/doc/html/Text-Parsec-Prim.html#v:parse), which is part of Parsec, might have a type like: