File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 532532
533533 instance functorStateT :: (Monad m) => Functor (StateT s m)
534534
535+ instance lazy1StateT :: Lazy1 (StateT s m)
536+
535537 instance monadPlusStateT :: (MonadPlus m) => MonadPlus (StateT s m)
536538
537539 instance monadStateT :: (Monad m) => Monad (StateT s m)
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Control.Alternative
55import Control.Plus
66import Control.Monad.Trans
77import Control.MonadPlus
8+ import Control.Lazy
89import Data.Tuple
910
1011newtype StateT s m a = StateT (s -> m (Tuple a s ))
@@ -55,6 +56,9 @@ instance monadTransStateT :: MonadTrans (StateT s) where
5556 x <- m
5657 return $ Tuple x s
5758
59+ instance lazy1StateT :: Lazy1 (StateT s m ) where
60+ defer1 f = StateT $ \s -> runStateT (f unit) s
61+
5862liftCatchState :: forall s m e a . (m (Tuple a s ) -> (e -> m (Tuple a s )) -> m (Tuple a s )) -> StateT s m a -> (e -> StateT s m a ) -> StateT s m a
5963liftCatchState catch m h = StateT $ \s -> catch (runStateT m s) (\e -> runStateT (h e) s)
6064
You can’t perform that action at this time.
0 commit comments