File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 532
532
533
533
instance functorStateT :: (Monad m) => Functor (StateT s m)
534
534
535
+ instance lazy1StateT :: Lazy1 (StateT s m)
536
+
535
537
instance monadPlusStateT :: (MonadPlus m) => MonadPlus (StateT s m)
536
538
537
539
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
5
5
import Control.Plus
6
6
import Control.Monad.Trans
7
7
import Control.MonadPlus
8
+ import Control.Lazy
8
9
import Data.Tuple
9
10
10
11
newtype StateT s m a = StateT (s -> m (Tuple a s ))
@@ -55,6 +56,9 @@ instance monadTransStateT :: MonadTrans (StateT s) where
55
56
x <- m
56
57
return $ Tuple x s
57
58
59
+ instance lazy1StateT :: Lazy1 (StateT s m ) where
60
+ defer1 f = StateT $ \s -> runStateT (f unit) s
61
+
58
62
liftCatchState :: 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
59
63
liftCatchState catch m h = StateT $ \s -> catch (runStateT m s) (\e -> runStateT (h e) s)
60
64
You can’t perform that action at this time.
0 commit comments