mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-11 02:01:36 +03:00
explicit lambdas for mapXYZ functions
This commit is contained in:
parent
a42a34e9f0
commit
313f52a88a
@ -90,7 +90,7 @@ execRWS m r s = let (_,s1,w) = runRWS m r s
|
||||
public export %inline
|
||||
mapRWS : (Monoid w, Semigroup w')
|
||||
=> ((a, s, w) -> (b, s, w')) -> RWS r w s a -> RWS r w' s b
|
||||
mapRWS f = mapRWST (Id . f . runIdentity)
|
||||
mapRWS f = mapRWST \(Id p) => Id (f p)
|
||||
|
||||
||| `withRWS f m` executes action `m` with an initial environment
|
||||
||| and state modified by applying `f`.
|
||||
|
@ -59,7 +59,7 @@ execState s = fst . runState s
|
||||
||| the given function.
|
||||
public export %inline
|
||||
mapState : ((s, a) -> (s, b)) -> State s a -> State s b
|
||||
mapState f = mapStateT (Id . f . runIdentity)
|
||||
mapState f = mapStateT \(Id p) => Id (f p)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Implementations
|
||||
|
@ -70,7 +70,7 @@ execWriter = runIdentity . execWriterT
|
||||
public export %inline
|
||||
mapWriter : (Monoid w, Semigroup w')
|
||||
=> ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
|
||||
mapWriter f = mapWriterT (Id . f . runIdentity)
|
||||
mapWriter f = mapWriterT \(Id p) => Id (f p)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Implementations
|
||||
|
Loading…
Reference in New Issue
Block a user