[Haskell-cafe] Re: I love purity, but it's killing me.

Chung-chieh Shan ccshan at post.harvard.edu
Wed Feb 13 02:55:16 EST 2008


Henning Thielemann <lemming at henning-thielemann.de> wrote in article <Pine.GSO.4.56.0802080908310.12174 at haydn.informatik.uni-halle.de> in gmane.comp.lang.haskell.cafe:
> It seems to become a FAQ. I think all DSLs suffer from the same problems:
> sharing and recursion. I've used wrappers for CSound, SuperCollider,
> MetaPost, they all have these problems.

What do you mean by the "recursion" problem?

Sometimes (or perhaps even often), sharing in an EDSL can be expressed
in two ways.  First, to reuse a -value- in the embedded language, you
could introduce a "let" construct in the embedded language.

    let_ expr body = body expr

Second, to reuse an -expression- in the embedded language, if your
interpreter is compositional (here by "interpreter" I include a
compiler, and by "compositional" I mean a fold), then you can represent
an embedded expression simply as its interpretation.

    add x y = x + y
    let expr = add x y in add expr expr

Jacques Carette, Oleg Kiselyov, and I have been exploring this "final"
representation.  http://okmij.org/ftp/Computation/tagless-typed.html

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
I am a signature virus. Put me in your signature.



More information about the Haskell-Cafe mailing list