[Haskell-cafe] nested maybes

Bryan Donlan bd.haskell at uguu.us
Mon Feb 5 10:54:08 EST 2007


Martin DeMello wrote:
> On 2/5/07, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>> Hello J.,
>>
>> Sunday, February 4, 2007, 11:46:57 PM, you wrote:
>>
>> > exists s wmap = isJust $ find (==s) . snd =<< Map.lookup (sort s) wmap
>>
>> exists s wmap =      Map.lookup (sort s) wmap
>>                 >>== snd
>>                 >>== find (==s)
>>                 >>== isJust
>>
>> a>>==b = a>>=return.b
> 
> Very nice! Didn't know about >>==. Thanks to everyone else who
> responded too; I'm learning a lot from this thread.

(>>==) is user-defined; that's what the last line is for :)


More information about the Haskell-Cafe mailing list