
The Tagless final approach can do context-sensitive evaluation, using the well-known trick from the denotational semantics that explicating the context turns context-sensitive semantics to compositional. The trick isn't out of place given how much tagless-final approach is related to denotational semantics. The non-compositional processing has been discussed at length at lectures last year. Please see the explanation and the code at Non-compositionality: Fold-unlike processing http://okmij.org/ftp/tagless-final/course/course.html#non'compositionality Interestingly, one example FlatF.hs mentioned on the above page specifically talks about the context of being the left operand of the addition (the goal was to `flatten' additions, to re-associate them to the right). That is the same context as you are after, it seems. The detailed lecture notes will be eventually available.