Last post we looked at using a less general form of the Free monad to purely represent side-effects in F#. Because Haskell supports higher-order polymorphism it makes using this approach much easier. Here is the complete example from that post, rewritten in Haskell:
This is using Free and liftF from Control.Monad.Free, but for the sake of equivalence with the F# example, here’s a definition that can be used in place of the import Control.Monad.Free line in the above code.