Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instance (Monad m) => Applicative (StateT s m) where
- pure a = StateT $ \s -> pure $ (a, s)
- (<*>) :: (StateT s m (a -> b)) -> (StateT s m a) -> (StateT s m b)
- (StateT smf) <*> (StateT sma) = StateT $ \s -> do
- (f, s1) <- smf s
- (a, s2) <- sma s
- return (f a, s2)
Add Comment
Please, Sign In to add comment