performance of monads

William Lee Irwin III wli@holomorphy.com
Wed, 16 Jan 2002 02:47:58 -0800


Eric Allen Wohlstadter <wohlstad@cs.ucdavis.edu> wrote,
>> non-local transfer of control. Similiar is the way State is handled. Do
>> compilers for haskell do any sort of optimization on these monadic
>> operations or is it all as ineffecient as it looks.

On Wed, Jan 16, 2002 at 08:59:14PM +1100, Manuel M. T. Chakravarty wrote:
> PS: These optimisations will usually only apply to monads
>     that are defined as part of the system libraries of a
>     Haskell system, not to user-defined ones (unless a user
>     uses non-standard system features to implement the
>     monad).

This piques my interest. It would be my hope that interprocedural
analysis could unravel the control transfers implied by the monadic
code at least up to the point where the runtime system calls are
introduced, with the natural proviso that some sort of time/space
tradeoff threshhold is used to throttle code bloat. Is it the case this
is possible in general or are there fundamental barriers to doing this
with e.g. dumps of appropriate IR bits during separate compilation?


Cheers,
Bill