@@ -19,6 +19,13 @@ instance Functor f => Functor (StateT s f) where
19 mapFst : (a -> x) -> (a, b) -> (x, b)
19 mapFst : (a -> x) -> (a, b) -> (x, b)
20 mapFst fn (a, b) = (fn a, b)
20 mapFst fn (a, b) = (fn a, b)
22+instance Monad f => Applicative (StateT s f) where
23+ pure x = ST (\st => pure (x, st))
25+ (ST f) <$> (ST a) = ST (\st => do (g, r) <- f st
22instance Monad m => Monad (StateT s m) where
29instance Monad m => Monad (StateT s m) where
23 return x = ST (\st => return (x, st))
30 return x = ST (\st => return (x, st))