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

Henning Thielemann lemming at henning-thielemann.de
Sat Feb 9 00:20:39 EST 2008


On Fri, 8 Feb 2008, Tom Hawkins wrote:

> 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.

Also in a pure Haskell library you will try to avoid direct access to
constructors, because the internal data structures might change. Better
are functions that access the internal data of a type, like 'maybe' and
'either' for 'Maybe' and 'Either', respectively.


More information about the Haskell-Cafe mailing list