I have the following code
u & currentDay %~ fmap (addDays 1)
currentDay
returns a Maybe
which is why I need the fmap
.
Is there already an operator to combine %~
and fmap
(like %~<$>
;-)) or a clever way to do so ?
I have the following code
u & currentDay %~ fmap (addDays 1)
currentDay
returns a Maybe
which is why I need the fmap
.
Is there already an operator to combine %~
and fmap
(like %~<$>
;-)) or a clever way to do so ?
There is no existing operator for this but you could easily define your own:
The standard way to do this is to use the
mapped
setter:Since your mapping over a
Maybe
you could also use_Just
prism: