Free monads for convenient AST construction