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:

parse :: [...] s ->
Either<http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Either.html#t:Either>
 
ParseError<http://hackage.haskell.org/packages/archive/parsec/latest/doc/html/Text-Parsec-Error.html#t:ParseError>
 a

Meaning, parsing will either fail with a Left ParseError, or succeed with a
Right a, where a is whatever type your parser returns.

Hope that helps,

Alvaro





On Wed, Feb 6, 2013 at 9:37 PM, Jacob Thomas <jthom...@ucsc.edu> wrote:

>
> 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
>
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to