[Haskell] Evil code

Albert Lai trebla at vex.net
Tue Oct 3 22:36:01 EDT 2006

Thomas Davie <tom.davie at gmail.com> writes:

> The evil code and CPSness were actually intended to be completely
> separate entities.  I needed (and to a lesser extent now still need),
> examples that are (a) very higher order, and (b) evil and hard to
> understand the runtime behaviour of.

Generally code that produces and consumes lots of tuples, e.g., common
implementations of splitAt, span, mapAccumL (these are list
functions), the State monad (Control.Monad.State; you can strip out
the "instance Monad" thing and package the code as ordinary

Also Phil Wadler's "Monads for Functional Programming"
contains a monadic parser.  In section 5.11 "improving laziness" two
different ways of coding and their respective laziness effects are
shown.  This can be further exemplified by debugger traces, methinks.

More information about the Haskell mailing list