Fwd: [Haskell-cafe] DSL libraries

steffen steffen.siering at googlemail.com
Sun Nov 7 08:35:15 EST 2010


Hey,

Sorry, hard week and I haven't had time to look into it until now. I
remember having had the very same Problem with AwesomePrelude. A very
quick fix for me was to remove the "Lang.*" and "Compiler.*" entries
in "exposed-modules" in the cabal file. You won't really need them
anyway.

If you really want to try AwesomePrelude, you may find the need to
changes some parts of it. For example, the AwesomePrelude's Num class
implies a Show instance, which can be very annoying. So best is to use
it as base for your own code and steal from it what you will need or
create your own version of AwesomePrelude according to your own
needs.

For example calling "test" in this example[1] will print out "num" and
when defining your own Show-Instance your program won't compile due to
overlapping instances.

The same example using AwesomePrelude with associated data families[2]
introducing new types for every aspect of your DSL  will look like [3]
(See the Lang.* Modules for more examples and evaluation, for this
kind of type safe DSL).

[1] https://gist.github.com/666119
[2] https://github.com/urso/AwesomePrelude
[3] https://gist.github.com/666121

On 4 Nov., 18:51, Dupont Corentin <corentin.dup... at gmail.com> wrote:
> Nobody had the compilation messages I had?
>
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Dupont Corentin <corentin.dup... at gmail.com>
> Date: Tue, Nov 2, 2010 at 2:30 PM
> Subject: [Haskell-cafe] DSL libraries (Was: Map constructor in a DSL)
> To: steffen <steffen.sier... at googlemail.com>, haskell-c... at haskell.org
>
> Hello Steffen,
> can you compile AwesomePrelude?
> I've got error messages (see below).
>
> By the way, I've looked at some DSLs made in Haskell, if I don't mistake
> there are lots of similarities between them.
> There similarities could be put in a library to help the implementors of a
> DSL, more or less like AwesomePrelude.
>
> Is there already packages on Hackage dealing with that?
>
> Cheers,
> Corentin
>
> AwesomePrelude compilation error:
> I'm using GHC 6.12.1.
>
> > cd tomlokhorst-AwesomePrelude-9819315
> > cabal install
> (...)
> Warning: Lang.Haskell: Instances of type and data families are not yet
> supported. Instances of the following families will be filtered out:  H
>
> Then, when trying with a very simple GATD in GHCI, I've got:
>
> <interactive>: HSAwesomePrelude-0.1.0.o: unknown symbol
> `AwesomePreludezm0zi1zi0_
> CompilerziLiftDefinitions_inline_closure'
> ghc: unable to load package `AwesomePrelude-0.1.0'
>
> On Thu, Oct 28, 2010 at 2:02 PM, steffen <steffen.sier... at googlemail.com>wrote:
>
> > I think you would love to have a look at AwesomePrelude[1] or a fork
> > of AwesomePrelude using associated types[2]
> > Some more background information by Tom Lokhorst [3][4].
>
> > [1]http://github.com/tomlokhorst/AwesomePrelude
> > [2]http://github.com/urso/AwesomePrelude
> > [3]http://tom.lokhorst.eu/2009/09/deeply-embedded-dsls
> > [4]http://tom.lokhorst.eu/2010/02/awesomeprelude-presentation-video
>
> > On 28 Okt., 12:09, Dupont Corentin <corentin.dup... at gmail.com> wrote:
> > > Thank you for your rich responses.
>
> > > Indeed I think I miss some thinks in my DSL, that would make things
> > easier
> > > to deal with lists and first class functions.
> > > I don't really know what for now.
> > > Perhaps a List Constructor? Or a constructor on functions like yours
> > Ryan?
> > > EAp :: Exp ref (a -> b) -> Exp ref a -> Exp ref b
> > > It's from which DSL? It is accessible on the net?
>
> > > Chris suggested me that I can only define the Foldr constructor and
> > deduce
> > > Map from it.
> > > But maybe I have to add a List constructor for that.
>
> > > But in the suggestions from Ryan and Brandon I don't understand why I
> > should
> > > add an extra type parameter and what it is!
>
> > > Steffen: Wow nice. I'll integrate that ;)
>
> > > I'm also looking at the Atom's DSL to get inspiration.
> > > Something I don't understand in it is that it has two languages, on
> > typed:
>
> > > data E a where
> > >   VRef    :: V a -> E a
> > >   Const   :: a -> E a
> > >   Cast    :: (NumE a, NumE b) => E a -> E b
> > >   Add     :: NumE a => E a -> E a -> E a
> > > etc.
>
> > > And, along with it, an untyped counterpart:
>
> > > -- | An untyped term.
> > > data UE
> > >   = UVRef UV
> > >   | UConst Const
> > >   | UCast  Type UE
> > >   | UAdd   UE UE
> > > etc.
>
> > > What that for? What's the use of having beautiful GADT if you have to
> > > maintain an untyped ADT aside??
>
> > > Corentin
>
> > > _______________________________________________
> > > Haskell-Cafe mailing list
> > > Haskell-C... at haskell.orghttp://
> >www.haskell.org/mailman/listinfo/haskell-cafe
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-C... at haskell.org
> >http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-C... at haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list