[Haskell-cafe] more thoughts on "Finally tagless"

Stephen Tetley stephen.tetley at gmail.com
Mon Mar 8 15:50:47 EST 2010

Hi Günther

The finally tagless style is an implementation of the TypeCase pattern
(Bruno C. d. S. Oliveira and Jeremy Gibbons):


TypeCase can be implemented via GADTs or type classes - typed printf
in section 4.2 of the paper is shown in both versions.

The authors of the "Finally Tagless" note in the long version of their
paper that the GADT TypeCase had some problems with non-exhaustive
pattern matching (last paragraph, page 14) - if I'm understanding it
correctly, in order to be total, the interpretation function stills
needs to introduce pattern matching clauses in some circumstances for
values that the GADT actually prevents occurring.

Plain old data types can easily be interpreted by multiple evaluators
- the benefit of TypeCase is probably when you want some degree of
extensibility, see this message for instance:


Best wishes


More information about the Haskell-Cafe mailing list