[Haskell-cafe] Pointed, but not Applicative

Maciej Marcin Piechotka uzytkownik2 at gmail.com
Sun Aug 28 18:21:41 CEST 2011


On Sun, 2011-08-28 at 11:48 -0300, Felipe Almeida Lessa wrote:
> On Sun, Aug 28, 2011 at 7:41 AM, Tony Morris <tonymorris at gmail.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110828/223c1ede/attachment.pgp>


More information about the Haskell-Cafe mailing list