The Writer MonadYou can think of monoids as being accumulators. Given a running total, n, we can add in a new value a to get a new running total n' = n `mappend` a. Accumulating totals is a very common design pattern in real code so it's useful to abstract this idea. This is exactly what the Writer monad allows. We can write monadic code that accumulates values as a "side effect". The function to perform the accumulation is (somewhat confusingly) called tell. Here's an example where we're logging a trace of what we're doing.
Fatvat: Speeding up the Ants program - 0 views
Learning Clojure: Clojure is Fast - 0 views
1More
Bluish Coder: Dynamic Compilation and Loading of Modules in Haskell - 0 views
How to use random numbers? - 0 views
Fatvat: Debugging in Haskell - 0 views
1 - 10 of 10
Showing 20▼ items per page