| Joachim Durchholz 2005-11-07, 10:03 pm |
| Andre schrieb:
>
> By the way, why indeed does Haskell have
> the "do" notation? Isn't "do" a macro, after all?
Yes.
> Wouldn't it have been nice not to have had to wait for a new version
> of each of the compilers to have access to the "do" notation when
> it was initially introduced?
Well, it's the only macro that the Haskellers ever found worth adding to
the language. Inventing a macro sublanguage just to define a single
macro might have seemed overkill to them :-)
(There's a bit of white lying involved here - (a) I'm not really sure
that "do" is the only syntactic sugar in Haskell, (b) I'm pretty sure
that the Haskell people *first* decided against using a macro system,
and *then* found reasons to introduce "do.)
> Is "do" going to be the only such
> notation that will ever be useful?
Seems so. I don't see Haskellers clamoring for additional syntactic sugar.
I'm not even sure that a few well-designed HOFs couldn't replace the
"do" notation. As somebody else noted, "do" isn't *that* useful anyway.
> What if you come up with
> a wonderful new DSL analogous to "do" for, say, arrows, that made
> thinking about them so much easier, and wanted to use it in writing
> and portably sharing programs?
Personally, I think that "do" more obscures than eases thinking about
monads. It pretends a sequencing that isn't there - at least not in the
way that the code indicates. It isn't even useful for all monads -
nobody uses the "do" notation for lists, for example.
I think the FPL world is still recovering from the shock that the
introduction of category theory was. People are *very* reluctant to try
new concepts (such as Arrows); they haven't fully digested monads yet.
Regards,
Jo
|