"Introspective writer"? It seems that the interesting thing you can do with it (which you cannot do with Writer) is to write an introspect function that checks the status / output and modifies it:
introspect :: (s -> s) -> M s () introspect f = M $ \s -> (fs, ())
I donβt see that you can do this for a writer, I think you have to do it with a post-transformer:
postW :: Writer wa -> (w -> w) -> Writer wa postW ma f = Writer $ let (w,a) = getWriter ma in (fw,a)
stephen tetley
source share