mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-29 14:44:03 +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
|
||||
(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
|
||||
public export
|
||||
modify : MonadState stateType m => (stateType -> stateType) -> m ()
|
||||
|
Loading…
Reference in New Issue
Block a user