[Haskell-cafe] Re: How does one get off haskell?

Ron Alford ronwalf at volus.net
Mon Jun 21 11:54:30 EDT 2010


On Fri, Jun 18, 2010 at 10:30 AM, C. McCann <cam at uptoisomorphism.net> wrote:
> The better question is "when do the benefits of static typing outweigh
> the costs imposed?". If you're using Java, the answer is probably
> "never", but even in Haskell I don't think the answer is quite
> "always".

I have half a concrete example!  I do research in automated planning,
and the standard problem definition language is PDDL[1].
PDDL uses FOL logic expressions for expressing goal conditions, action
preconditions, effects and various other things.  The problem comes in
that it uses a /different/ subset of first-order logic for each
expression, leading to something like 8 or so expression types
contained just in PDDL 3.1 (the latest 'standard').  Then there are
the many previous versions of PDDL, and all the many extensions and
subset/extensions to various versions of PDDL used in other people's
research projects.

So, when I wrote a PDDL library to help with my research, I needed
extensibility.   If not, I'd need to either fork the library for every
PDDL extension, or create some sort of uber-PDDL which contained all
the extensions.  The best I came up with is Wouter's Datatypes a la
Carte [2] which I used along with an extensible record technique my
implementation[3]*.

There are downsides to this approach.  The most obvious is that to
define a function over one of these datatypes, you need to define a
class associated with that function and then define an instance of
that class for every component.
Also, type signatures are huge and I feeling like I'm using half the
language extensions out there.  I end up with a full complement of
boilerplate code, and it doesn't even buy me full expression type
safety (there are restrictions in PDDL on how expressions combine).

Now, one thing I'm missing out of this example is the other side of
the coin - doing it better in a dynamically typed language.  However,
there are plenty of C, lisp, and python PDDL planners out there, and
I'm pretty sure they don't bother with type safe expressions.  Also,
this isn't an indictment of static typing in general.  This only shows
that my task isn't well suited to Haskell's current static typing.

-Ron Alford


* Note that this was my first and only real haskell project, and all
that this entails.

[1] http://en.wikipedia.org/wiki/Planning_Domain_Definition_Language
[2] http://lambda-the-ultimate.org/node/2700
[3] http://www.cs.umd.edu/projects/planning/data/alford09translating/


More information about the Haskell-Cafe mailing list