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
mappedsetter:Since your mapping over a
Maybeyou could also use_Justprism: