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

minh thu noteed at gmail.com
Wed Oct 7 11:49:02 EDT 2009


Hi,

Some random observation:

A (E)DSL and an API fall on the same plane when they just expose
functionality of a library.

The difference between EDSL and a DSL is really just the E which means
embedded into a host language so the embedded language can be built on
top of some existing machinery, in Haskell typically the type system.

Haskell is particularly good for EDSL (but also Scheme or CL) because
the syntax of Haskell lets have a nice syntax for the embedded
language and the type system makes it possible to have, with more or
less simplicity, typing guarantees for the specifi language.

A regular expression library comprises often a regexp language, which
is considerd part of the API. That language is (or can be) parsed,
compiled and executed.

Some EDSL require to execute the Haskell program to output some
"object" code, others require only the execution of some function
equivalent to runState for the particular monad the EDSL uses.

Providing a specialised language on top of a library is quite common,
for instance command line tools to process images. Those command line
tool can later be used in some progreams (think scripting languages).
For instance, the "dot" program of the graphviz suite can be run with
unsafePerformIO to get graphviz features inside Haskell.

Parsing a String into some data structure is just a special case of
transforming some data structure into other data structure because it
easier to process that way. For instance HOAS into de Bruijn and vice
versa.

So for me, there is not a so strong distinction between API and language.

Cheers,
Thu

2009/10/7 Joe Fredette <jfredett at gmail.com>:
> Let me add to this, as I've used the term "DSL" without (*gasp*) fully
> understanding it before.
>
> In addition to "What is a DSL", I'd like to ask:
>
> "How is a DSL different from an API?" -- in the sense that an API is a set
> of, say, combinators to filter email + a monad in which to combine them. Or
> even the API in the more traditional sense of the set of exposed operations
> on a given type. Is an API a kind of DSL? A kind of Embedded DSL?
>
> Also,
>
> "What is the difference between an EDSL and a DSL?" -- I've got a vague
> intuition of the difference, but am unsure how to particularly delineate
> them.
>
> Also, any good introductory papers/books/other resources on DSLs and how to
> design, build and use them would be _lovely_.
>
> /Joe
>
> On Oct 7, 2009, at 11:10 AM, Günther Schmidt wrote:
>
>> 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