Stop Paying for Free Monads

Free monads, as used in the “Datatypes à la carte” pattern, are a useful way to structure code, separating of specification from implementation and enabling modularisation.

But they also come with a runtime performance penalty.

The complementary “typed tagless final interpreters” approach (popularised in the Haskell and OCaml worlds by Oleg Kiselyov) offers a performance boost over free monads, yet available sample code centers around simple expression langauges, and “real world” examples are hard to come by.

In this talk, we’ll compare and contrast the TTFI approach with Datatypes à la carte and explore how it can be used in real production code — with configuration, state, side effects and error handling.

 
 

Target Audience

All

schedule Submitted 1 month ago

Public Feedback

comment Suggest improvements to the Speaker