I\'ve been using a free monad to build a DSL. As part of the language, there is an input
command, the goal is to reflect what types are expected by the input primit
I have a working implementation of an indexed free monad on github from a few years back:
https://github.com/ekmett/indexed/blob/master/src/Indexed/Monad/Free.hs
It uses the form of indexed monad proposed by Conor McBride in Kleisli Arrows of Outrageous Fortune, and that can be adapted to provide a 2-index free monad in the style of Bob Atkey in the manner described in the paper as well.