Strange Loop

Building Haskell Programs with Fused Effects

Haskell is a purely functional programming language: by default, Haskell functions do not cause side effects such as system I/O, nondeterminism, or exception handling. As such, Haskell programs are generally expressed in terms of monad transformers, which provide the facility to compose different side effects into a single interface powerful enough to express the programmer's needs. The monad transformer library, mtl, is mature and powerful, but complicates and in some cases constrains the construction and generalization of user-specified monads.

A class of libraries known as 'effect systems' have emerged in an attempt to solve the problems associated with monad transformers. Effect systems provide a compositional approach to program construction, generally using a single monadic type specialzed with a programmer-provided list of capabilities. Effect systems are more powerful and flexible than monad transformers, but their adoption in industry has been minimal, due both to their incompatiblity with mtl and their historically poor performance.

The new fused-effects library changes the status quo: it provides an extensible and flexible vocabulary for program construction, yielding a more expressive interface than mtl without sacrificing any performance characteristics. I'll describe the history of effect systems, outline the tradeoffs associated with programming with effects, and demonstrate the use of fused-effects in practice.

Patrick Thomson

Patrick Thomson

GitHub, Inc.

Patrick is a senior engineer on GitHub's Semantic Code team, building systems to understand and analyze the corpus of code on GitHub. He enjoys peaceful countryside walks and loud rap shows.