[Haskell-cafe] instance Applicative f => Applicative (StateT s f)
Ross Paterson
ross at soi.city.ac.uk
Fri Dec 5 13:02:39 EST 2008
On Fri, Dec 05, 2008 at 06:56:46PM +0100, Thomas Davie wrote:
> Which reminds me ofc, that there is a valid applicative for states
> (assuming the monad instance is valid):
>
> instance Applicative (StateT s f) where
> pure = return
> (<*>) = ap
>
> All monads are also applicatives ;)
Sure, as long as you add the assumption Monad f.
More information about the Haskell-Cafe
mailing list