
HI all, as a part of a project for physical simulation, I'm was given the task to help with the implementation of an Small DSL that is a minimal functional language. Point is that this small language contains some dependent typed theory, because we want to be able to check statically the shapes of vector and matrices, among other things. Haskell of course seems the tool for the job. But my boss insists that the implementation should be done in C, but I think that it is madness. Can someone please point me to relevant literature, discussions or general information that can help me to show my boss that Haskell is the right tool? any help would be appreciated. Felipe Z.

One option to consider is using Haskell as the host language for your DSL
but then generating either C or LLVM bytecode directly. Haskell has a few
DSLs in this vein like Ivory, Copilot and Atom which you can look to for
inspiration.
This can give you Haskell's expressiveness and type system coupled with the
speed, portability and compatibility of C or LLVM.
On Sep 17, 2014 11:03 AM, "felipe zapata"
HI all, as a part of a project for physical simulation, I'm was given the task to help with the implementation of an Small DSL that is a minimal functional language. Point is that this small language contains some dependent typed theory, because we want to be able to check statically the shapes of vector and matrices, among other things. Haskell of course seems the tool for the job. But my boss insists that the implementation should be done in C, but I think that it is madness. Can someone please point me to relevant literature, discussions or general information that can help me to show my boss that Haskell is the right tool?
any help would be appreciated.
Felipe Z.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, Sep 17, 2014 at 02:02:44PM -0400, felipe zapata wrote:
HI all, as a part of a project for physical simulation, I'm was given the task to help with the implementation of an Small DSL that is a minimal functional language. Point is that this small language contains some dependent typed theory, because we want to be able to check statically the shapes of vector and matrices, among other things. Haskell of course seems the tool for the job. But my boss insists that the implementation should be done in C, but I think that it is madness. Can someone please point me to relevant literature, discussions or general information that can help me to show my boss that Haskell is the right tool?
any help would be appreciated.
Why try to convince him? ;) There is always the option of disregarding what the boss says and just do it in Haskell and face the music later. I've done this kind of thing a few times, but only when all of the following hold: 1. I am 100% sure I am right and the other party is wrong 2. I am confident I can tackle a large enough part of the problem and have something to show before reaching a point of no return (i.e. I must be able to show something that convincingly shows that I am going down the correct path before reaching the point where switching to the "inferior path" becomes impossible) 3. I feel safe enough in my employment that I can handle a spectacular failure, or I don't care enough about my employment to worry a spectacular failure If you want to try to convince him I would urge you to not spend too much time on the technical superiority of using Haskell to implement the DSL. Instead you should spend time on finding out what makes your boss suggest using C. Is it familiarity? Is it worry about future maintenance? Is it just habit? C is almost *always* an inferior choice so anyone arguing in favour of it is probably doing it for emotional reasons, not technical! (Only slightly tongue-in cheek.) /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus In a hierarchy, every employee tends to rise to his level of incompetence. -- The Peter Principle

You have looked at the latest HMatrix with its static guarantees: Numeric.LinearAlgebra.Static? I think it is brilliant. It actually caught a bug in my mathematical derivation. I had written out the equations in LaTeX and then coded them up and couldn't understand why I was getting a type error until I realised it was my derivation that was wrong. Have a look here at its use: http://idontgetoutmuch.wordpress.com/2014/09/09/fun-with-extended-kalman-fil....

I don't know if this is helpful but the example I gave also uses automatic differentiation. Of course, one can get that in C++ using STAN.

Hi Felipe,
We performed an (unplanned) experiment relevant to your case. We developed a DSL in Haskell and a library of math functions while IBM was doing the same thing in C.
http://doi.ieeecomputersociety.org/10.1109/TC.2008.223
The C library was 4X slower, and less accurate.
More recently we have wrapped-up a prototype for type-safe physical models and there is a preprint and three example implementations which might be of help in constructing your own.
http://www.cas.mcmaster.ca/~anand/papers/preprints.html
Good luck explaining why Haskell is so good for DSLs. You might find
http://cacm.acm.org/magazines/2011/7/109910-dsl-for-the-uninitiated/fulltext
helpful.
Christopher
On Sep 17, 2014, at 2:02 PM, felipe zapata
HI all, as a part of a project for physical simulation, I'm was given the task to help with the implementation of an Small DSL that is a minimal functional language. Point is that this small language contains some dependent typed theory, because we want to be able to check statically the shapes of vector and matrices, among other things. Haskell of course seems the tool for the job. But my boss insists that the implementation should be done in C, but I think that it is madness. Can someone please point me to relevant literature, discussions or general information that can help me to show my boss that Haskell is the right tool?
any help would be appreciated.
Felipe Z. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

You may be interested in using C-DSL to generate your DSL’s output. It should keep your output readable.
https://bitbucket.org/jozefg/c-dsl
–
Kyle Marek-Spartz
On Sep 18, 2014, 8:18:10 AM, Dr Christopher Anand
participants (6)
-
Dominic Steinitz
-
Dr Christopher Anand
-
felipe zapata
-
Kyle Marek-Spartz
-
Magnus Therning
-
Tikhon Jelvis