[Haskell-cafe] I love purity, but it's killing me.
Tom Hawkins
tomahawkins at gmail.com
Fri Feb 8 18:28:50 EST 2008
On 2/8/08, Emil Axelsson <emax at cs.chalmers.se> wrote:
> I know of a few of ways to express sharing in a pure language:
>
> 1) "Observable sharing", which, in general, is unsafe.
> 2) Using Template Haskell
> 3) Matthew Naylor has done some work on "expressible sharing", which has
> 4) Use a monad (but I'm sure this is what you're trying to avoid).
Or...
5) Forget embedding the DSL, and write a direct compiler.
In addition to the sharing problem, another shortcoming of Haskell
DSLs is they can not fully exploit the benefits of algebraic
datatypes. Specifically, pattern matching ADTs can only be used to
control the compile-time configuration of the target, it can't be used
to describe the target's behavior -- at least for DSLs that generate
code that executes outside of Haskell's runtime.
Writing a real compiler would solve both of these problems. Is there
any Haskell implementation that has a clean cut-point, from which I
can start from a fully type-checked, type-annotated intermediate
representation?
And thanks for the link to John's paper describing Hydra's use of
Template Haskell. I will definiately consider TH.
-Tom
More information about the Haskell-Cafe
mailing list