mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-01 16:12:26 +03:00
Merge pull request #523 from mb64/hasio-statet
Implement HasIO for StateT
This commit is contained in:
commit
84ae9d7c6e
@ -58,6 +58,10 @@ implementation (Monad f, Alternative f) => Alternative (StateT st f) where
|
|||||||
empty = lift empty
|
empty = lift empty
|
||||||
(ST f) <|> (ST g) = ST (\st => f st <|> g st)
|
(ST f) <|> (ST g) = ST (\st => f st <|> g st)
|
||||||
|
|
||||||
|
public export
|
||||||
|
implementation HasIO m => HasIO (StateT stateType m) where
|
||||||
|
liftIO io = ST $ \s => liftIO $ io_bind io $ \a => pure (a, s)
|
||||||
|
|
||||||
||| Apply a function to modify the context of this computation
|
||| Apply a function to modify the context of this computation
|
||||||
public export
|
public export
|
||||||
modify : MonadState stateType m => (stateType -> stateType) -> m ()
|
modify : MonadState stateType m => (stateType -> stateType) -> m ()
|
||||||
|
Loading…
Reference in New Issue
Block a user