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

Antoine Latter aslatter at gmail.com
Thu Apr 14 00:29:15 CEST 2011


On Wed, Apr 13, 2011 at 5:14 PM,  <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?
>

Pattern matching works in ghci:

> let x = Just (Left (Blah [stuff]))
> let (Just (Left (Blah y)) = x

Antoine

> thanks
> Lee Short
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list