[Haskell-cafe] Trying to write an Embedded DSL that threads a monad?

Oleg oleg at okmij.org
Thu Oct 15 12:55:42 UTC 2015



> Ian Bloom wrote:
> I've been hoping to design a domain specific embedded language in
> Haskell that would let me pipe a commutative monad throughout an expression
> written in the language. Special terms within the language will eventually
> have access to this monad.


Is there a reason tagless-final approach does not work for you? You
can easily thread any monad, even if you don't make any provision for
it initially. For example,

        http://okmij.org/ftp/tagless-final/index.html#call-by-any
        http://okmij.org/ftp/tagless-final/course/CBAny.hs

uses monad to print out traces of the expression and then later to
implement lazy evaluation for EDLS (which needs mutable cells).




More information about the Haskell-Cafe mailing list