Daniel Gorín | 2 Aug 12:18 2013
Picon

Proposal: Add Monad instance for WrappedMonad

Control.Applicative.WrappedMonad allows one to use the Functor and Applicative interfaces of
something that is only known to be a Monad but, oddly enough, it hides its Monad interface.  The proposal is
to add the missing Monad instance. 

A typical use case for this instance would be:

f :: Failure String m => T1 -> m T2
f = unwrapMonad . f'
  where
    f' x = do ...  -- one can also use (<$>), (<*>), etc here

(NB. the Failure class is a subclass of Monad only).

A related proposal for the transformers package would be to add a MonadTrans instance for WrappedMonad as well.

Thanks,
Daniel
Roman Cheplyaka | 2 Aug 12:28 2013

Re: Proposal: Add Monad instance for WrappedMonad

Makes sense. +1

* Daniel Gorín <dgorin <at> dc.uba.ar> [2013-08-02 12:18:11+0200]
> Control.Applicative.WrappedMonad allows one to use the Functor and Applicative interfaces of
something that is only known to be a Monad but, oddly enough, it hides its Monad interface.  The proposal is
to add the missing Monad instance. 
> 
> A typical use case for this instance would be:
> 
> f :: Failure String m => T1 -> m T2
> f = unwrapMonad . f'
>   where
>     f' x = do ...  -- one can also use (<$>), (<*>), etc here
> 
> (NB. the Failure class is a subclass of Monad only).
> 
> A related proposal for the transformers package would be to add a MonadTrans instance for WrappedMonad as well.
> 
> Thanks,
> Daniel
John Wiegley | 2 Aug 23:43 2013

Re: Proposal: Add Monad instance for WrappedMonad

>>>>> Daniel Gorín <dgorin <at> dc.uba.ar> writes:

> Control.Applicative.WrappedMonad allows one to use the Functor and
> Applicative interfaces of something that is only known to be a Monad but,
> oddly enough, it hides its Monad interface.  The proposal is to add the
> missing Monad instance.  A typical use case for this instance would be:

> A related proposal for the transformers package would be to add a MonadTrans
> instance for WrappedMonad as well.

+1

--

-- 
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries
Nathan van Doorn | 3 Aug 10:53 2013
Picon

Re: Proposal: Add Monad instance for WrappedMonad

Definitely +1 from me


On 2 August 2013 22:43, John Wiegley <johnw <at> fpcomplete.com> wrote:
>>>>> Daniel Gorín <dgorin <at> dc.uba.ar> writes:

> Control.Applicative.WrappedMonad allows one to use the Functor and
> Applicative interfaces of something that is only known to be a Monad but,
> oddly enough, it hides its Monad interface.  The proposal is to add the
> missing Monad instance.  A typical use case for this instance would be:

> A related proposal for the transformers package would be to add a MonadTrans
> instance for WrappedMonad as well.

+1

--
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries

Gmane