[Haskell-cafe] Re: Monad for HOAS?

Chung-chieh Shan ccshan at post.harvard.edu
Wed May 14 18:01:37 EDT 2008

Conal Elliott <conal at conal.net> wrote in article <ea8ae9fb0805140915of9434b1la727da90de82635a at mail.gmail.com> in gmane.comp.lang.haskell.cafe:
> I share your perspective, Edsko.  If foo and (Let foo id) are
> indistinguishable to clients of your module and are equal with respect to
> your intended semantics of Exp, then I'd say at least this one monad law
> holds.  - Conal

I am at least sympathetic to this perspective, but the Expr constructors
are not as polymorphic as the monad operations: if in

    do a <- foo
       return a

foo has type "ExprM String" (perhaps foo is equal to "return []"), then
we want to generate the DSL expression "Let [] id", but "[]" is not of
type "Expr".  Because whenever foo's type is not "ExprM Expr" the above
code using do notation must be exactly equal to foo, by parametricity
even when foo's type is "ExprM Expr" we cannot generate Let.

Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
The pomotarians have nothing to lose but their value chains.

Call the Thermodynamics Police!

More information about the Haskell-Cafe mailing list