[Haskell-cafe] What *is* a DSL?

Joe Fredette jfredett at gmail.com
Wed Oct 7 11:32:57 EDT 2009


So, if I understand this:

Parsec is a DSL, I'm going to venture it's a "Deep embedding" -- I  
don't understand the internals, but if I were to build something like  
Parsec, I would probably build up a "Parser" datastructure and then  
apply optimizations to it, then "run" it with another function.

Am I on the right track here?

/Joe


On Oct 7, 2009, at 11:24 AM, Emil Axelsson wrote:

> Hi,
>
> A DSL is just a domain-specific language. It doesn't imply any  
> specific implementation technique.
>
> An *embedded* DSL is a library implemented in a more general  
> language, which has been designed to give the "feeling" of a stand- 
> alone language. Still nothing about implementation.
>
> A *shallow embedding* of a DSL is when the "evaluation" is done  
> immediately by the functions and combinators of the DSL. I don't  
> think it's possible to draw a line between a combinator library and  
> a shallowly embedded DSL.
>
> A *deep embedding* is when interpretation is done on an intermediate  
> data structure.
>
> / Emil
>
>
>
> Günther Schmidt skrev:
>> Hi all,
>> for people that have followed my posts on the DSL subject this  
>> question probably will seem strange, especially asking it now.
>> I have read quite a lot lately on the subject, most of it written  
>> by the great old ones, (come on guys you know whom I mean :)).
>> What I could gather from their papers was, that a DSL is basically  
>> something entirely abstract as such, ie. it allows you build and  
>> combine expressions in a language which is specific for your  
>> problem domain.
>> Irregardless of further details on how to do that, and there are  
>> quite a few, the crux as such is that they are abstract of "meaning".
>> The meaning depends how you *evaluate* the expression, which can be  
>> in more than merely one way, which is where, as far as I understand  
>> it, the true power lies.
>> So, you might wonder, since I figured it out this far, why ask what  
>> a DSL is?
>> Because out there I see quite a lot of stuff that is labeled as  
>> DSL, I mean for example packages on hackage, quite useuful ones  
>> too, where I don't see the split of assembling an expression tree  
>> from evaluating it, to me that seems more like combinator libraries.
>> Thus:
>> What is a DSL?
>> Günther
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list