Tagless Final vs Initial Style encodings - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Jonathan Lorimer

Is there a reason that tagless final encodings of monads seem to be so much less popular than initial style (especially free) encodings?

Jonathan Lorimer

this is purely anecdotal, from what I have seen in public forums

Solomon Bothwell

MTL typeclasses are tagless final style

Sandy Maguire

as a general rule, initial algebras are more "inspectable" -- you can transform them at will and do static analysis

Sandy Maguire

final algebras are just code! so they're fast! but come at the cost that you've lost your introspection

Sandy Maguire

the real play: use your final encoding to generate an initial one

Sandy Maguire

or! do some smart CPS stuff to your analysis/simplifications in the algebraic constructors themselves

Jonathan Lorimer

Woohoo! Thanks Sandy man!