Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-05 Thread Kim-Ee Yeoh
Joerg, For definitions I'd search for Andres Loeh and haskell edsl. His PDF slides also have code examples which'll help. Lennart also gave a talk this year titled making edsls fly. The video is on the web. If you have specific questions bring them to the list! The community is a tremendous

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-05 Thread Tillmann Rendel
Hi Joerg, Joerg Fritsch wrote: I am interested in the definition of deep vs shallow embedded I would say: In shallow embedding, a DSL is implemented as a library. Every keyword of the DSL is a function of the library. The implementation of the function directly computes the result of

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Joerg Fritsch
Hi Tillmann, is a shallow embedded DSL == an internal DSL and a deeply embedded DSL == an external DSL or the other way around? --Joerg On Dec 3, 2012, at 11:40 PM, Tillmann Rendel wrote: Hi, Joerg Fritsch wrote: I am working on a DSL that eventuyally would allow me to say: import

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Kim-Ee Yeoh
On Tue, Dec 4, 2012 at 4:53 PM, Joerg Fritsch frit...@joerg.cc wrote: is a shallow embedded DSL == an internal DSL and a deeply embedded DSL == an external DSL or the other way around? Roughly speaking, yes. But a deep DSL doesn't mean you've got to have a parser tokenizer IO input. You can

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Stephen Tetley
In Haskell, shallow DSLs generate values - deep DSLs generate structures (typically abstract syntax trees), the structure can subsequently be used to generate a value (or a C program, or a HTML page, etc.). See Andy Gill and colleagues Types and Type Families for Hardware Simulation and

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Tillmann Rendel
Hi, Joerg Fritsch wrote: is a shallow embedded DSL == an internal DSL and a deeply embedded DSL == an external DSL or the other way around? I mean internal == embedded, independently of deep vs. shallow, following Martin Fowler [1]. Tillmann [1]

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Kim-Ee Yeoh
Little things to check understanding: * ghc/ghci implements a DSL called Haskell -- does it do so in a deep or shallow way? * where are the shallow DSLs? the deep ones? (hint: some of them are right under our very noses!) -- Kim-Ee On Wed, Dec 5, 2012 at 12:49 AM, Stephen Tetley

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Kim-Ee Yeoh
On Wed, Dec 5, 2012 at 8:32 AM, Tillmann Rendel ren...@informatik.uni-marburg.de wrote: I mean internal == embedded, independently of deep vs. shallow, following Martin Fowler [1]. [1]

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-04 Thread Joerg Fritsch
Kim-Eeh, Tillmann, I am interested in the definition of deep vs shallow embedded, even if it is not featured in the Fowler textbook. Fowler that is one textbook only and I am not focused on it. --Joerg On Dec 5, 2012, at 2:59 AM, Kim-Ee Yeoh wrote: On Wed, Dec 5, 2012 at 8:32 AM, Tillmann

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-03 Thread Brent Yorgey
(Sorry, forgot to reply to the list initially; see conversation below.) On Mon, Dec 03, 2012 at 03:49:00PM +0100, Joerg Fritsch wrote: Brent, I believe that inside the do-block (that basically calls my interpreter) I cannot call any other Haskell function that are not recognized by my parser

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-03 Thread Joerg Fritsch
Thanks Brent, my question is basically how the function embed would in practice be implemented. I want to be able to take everything that my own language does not have from the host language, ideally so that I can say: evalt - eval (isFib::, 1000, ?BOOL)) case evalt of Left Str -

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-03 Thread Joerg Fritsch
The below is probably not a good example since it does not require a DSL but the principle is clear that I want to take things from teh host language that I do not have implemented (yet) in my DSL. --Joerg On Dec 3, 2012, at 4:25 PM, Joerg Fritsch wrote: Thanks Brent, my question is

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-03 Thread Tillmann Rendel
Hi, Joerg Fritsch wrote: I am working on a DSL that eventuyally would allow me to say: import language.cwmwl main = runCWMWL $ do eval (isFib::, 1000, ?BOOL) I have just started to work on the interpreter-function runCWMWL and I wonder whether it is possible to escape to real Haskell

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-02 Thread Rustom Mody
On Sun, Dec 2, 2012 at 7:31 PM, Joerg Fritsch frit...@joerg.cc wrote: This is probably a very basic question. I am working on a DSL that eventuyally would allow me to say: import language.cwmwl main = runCWMWL $ do eval (isFib::, 1000, ?BOOL) I have just started to work on the

Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-02 Thread Joerg Fritsch
Rusi, I have read Fowler's book.(that is focusing on Java by the way) and could not find the answer there, I think it is a typical textbook. I think this is a good start by the way: http://www.cse.chalmers.se/edu/year/2011/course/TIN321/lectures/bnfc-tutorial.html --Joerg On Dec 2, 2012, at