On Sun, 2011-08-28 at 11:48 -0300, Felipe Almeida Lessa wrote:
> On Sun, Aug 28, 2011 at 7:41 AM, Tony Morris <[email protected]> wrote:
> > Pointed f => Pointed (StateT s f)
> >
> > but not
> >
> > Applicative f => Applicative (StateT s f)
> 
> But we do have
> 
>     (Functor m, Monad m) => Applicative (StateT s m)
> 
> so I'm not sure if this is a valid example.
> 
> Cheers,
> 

newtype StateT s m a = StateT (s -> m (a, s))

instance Functor m => Functor (StateT s m) where
  f `fmap` StateT g = StateT $ fmap (first f) . g

instance Pointed m => Pointed (StateT s m) where
  point x = StateT $ point . (,) x

Regards

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to