[Haskell-cafe] monadic plumbing

2011-02-22 Thread Alberto G. Corona
Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in Either or Maybe results. functional compositions in the Either of Maybe , or list monads are not possible when the values are embedded inside

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Antoine Latter
On Tue, Feb 22, 2011 at 3:03 PM, Alberto G. Corona agocor...@gmail.com wrote: Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in  Either or Maybe results. functional compositions in the Either of

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Job Vranish
You need the MaybeT and EitherT monad transformers: http://hackage.haskell.org/packages/archive/MaybeT/0.1.2/doc/html/Control-Monad-Maybe.html http://hackage.haskell.org/packages/archive/MaybeT/0.1.2/doc/html/Control-Monad-Maybe.html

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Luke Palmer
On Tue, Feb 22, 2011 at 2:03 PM, Alberto G. Corona agocor...@gmail.com wrote: Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in  Either or Maybe results. functional compositions in the Either of

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Brandon Moore
From: Alberto G. Corona agocor...@gmail.com Sent: Tue, February 22, 2011 3:03:56 PM Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in Either or Maybe results. ... to summarize, given: foo, :

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Holger Siegel
Am 22.02.2011 um 22:03 schrieb Alberto G. Corona: Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in Either or Maybe results. functional compositions in the Either of Maybe , or list

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Evan Laforge
I have a function 'justm' for this specific case: -- | This is sort of like a monad transformer, but the Maybe is on the inside -- instead of the outside. -- -- What I really want here is MaybeT, but it requres explicit lifting... justm :: (Monad m) = m (Maybe a) - (a - m (Maybe b)) - m (Maybe b)