[Haskell-beginners] How to extract from Maybe & Either in GHCi

Benjamin Edwards edwards.benj at gmail.com
Thu Apr 14 00:19:31 CEST 2011


Use the maybe function from Data.Maybe.

maybe :: b -> (a->b) -> Maybe b -> b


On 13 April 2011 23:14, <blackcat at pro-ns.net> wrote:

> I've got some values in GHCi that look like
>
> Just (Left (Blah [stuff]))
>
> and I'd like to pull out the (Blah [stuff]) to operate on it.  Is there a
> way to do this directly in GHCi without writing a helper function?
>
> thanks
> Lee Short
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110413/baae3118/attachment.htm>


More information about the Beginners mailing list