It's available in MissingH:

http://hackage.haskell.org/packages/archive/MissingH/latest/doc/html/Data-Either-Utils.html#v:maybeToEither

You can find this using Hayoo, which indexes Hackage.

MissingH is pretty huge, though, just for one function. It's kind of
annoying. I'm using this function in my library and one other, in the
hopes I'll need more to make depending on MissingH worth it.

On 2 August 2010 16:14, Tom Davies <tgdav...@gmail.com> wrote:
> I find it convenient sometimes to convert a Maybe value to an Either thus 
> (excuse the syntax, it's CAL, not Haskell):
>
> maybeToEither :: a -> Maybe b -> Either a b;
> maybeToEither errorValue = maybe (Left errorValue) (\x -> Right x);
>
> but that seemingly obvious function isn't in Hoogle, AFAICT, so perhaps 
> there's some other approach?
>
> Thanks,
>  Tom_______________________________________________
> 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