retell f = Writer . second f $ runWriter
There is also a mapWriter
function provided by libraries. So you can do this:
retell = mapWriter . second
The second
function is in Control.Arrow
, but you can define its more general version as follows:
second f (a, b) = (a, fb)
source share