@@ -42,6 +42,10 @@ implementation MonadTrans (StateT stateType) where
42 lift x = ST (\st => do r <- x
42 lift x = ST (\st => do r <- x
43 pure (r, st))
43 pure (r, st))
45+implementation (Monad f, Alternative f) => Alternative (StateT st f) where
47+ (ST f) <|> (ST g) = ST (\st => f st <|> g st)
45||| Apply a function to modify the context of this computation
49||| Apply a function to modify the context of this computation
46modify : MonadState stateType m => (stateType -> stateType) -> m ()
50modify : MonadState stateType m => (stateType -> stateType) -> m ()
47modify f = do s <- get
51modify f = do s <- get