This is a reply to Fergus Henderson's comments on my proposal.

My answer to all his comments is that consistent languages are
easier to learn than languages littered with exceptions, special cases
and random default behaviour.

> > 1) Fixity declarations usually look like this:
> >       infixl 6 +, -
> >    but you can omit the precedence digit and write this instead:
> >       infixl +, -
> > 
> >    [which is bad...]
> 
> I don't think it's harder.  Even if the number is specified explicitly,
> I would *still* have to look up the precedence table in the report,
> or at least grep the source for the standard prelude, because
> I don't know what the precedence of the other operators is.

Grepping the Prelude won't tell you what the default precedence is
- so already the naive user is getting frustrated.  Then they remember
that their professor generously provided copies of tables 1 and 2 from the 
report (which summarise the precedence of various bits of syntax and
functions) along with a few other useful bits of info about Haskell.

But it's not there either - their professor didn't even know the precedence
digit was optional because they'd never seen it being used in any programs.
And besides, they don't want to list all the special cases in the Haskell
syntax - life is too short.

Then they grab a copy of their class textbook.  Not there either -
I guess the textbook writer didn't want to distract their readers with
that sort of unimportant nonsense.

So finally, they reach for the report and they find it.

Of course, I'd have reached for my copy of the report right away.
The naive user is very likely to try the easiest/shortest document first
and leave the Haskell report till last.

> > 3) Empty contexts are not allowed.

> Who would ever write them?
> 
> Even for programs that generate Haskell code, it's trivial to handle
> the empty context case differently.

Probably not many people - but it's still a pointless exception
and you have to remember to handle that empty case differently.

If I was writing a program that generated Haskell code, I might
well assume that empty contexts are allowed.  I might try my
system with one compiler and find that that particular compiler
relaxed this restriction.  I release it to the public, I get
a bug report saying that it doesn't work with compiler X,
I send a bug report to X-bugs@somewhere, they tell me it's the
correct behaviour, I ask them to fix it anyway, they say it's the
correct behaviour and they won't "break" their compiler just for me,
I fix my program and release a new version.

You can repeat this story with almost any exceptional case in the
syntax or the semantics.

> > 3) Contexts come in two flavours:
> >      f :: Ord a => a -> a -> Bool
> >    and
> >      f :: (Ord a, Bounded a) => a -> a -> Bool
> >    [and that's bad]
> 
> I could live with that, but it might break a lot of existing code.

Yes, my proposals will break a lot of code - but in a benign way:
the program will refuse to compile until you fix it.  The fix is
very obvious.  Once you've fixed it, it means the same as before.

For that matter, I doubt that implementers of existing compilers
would rush to remove clauses from their grammars (it's nigh-on
impossible to match the yacc/happy source with what the report
says so it's a brave man who deletes a syntax rule).

> > 4) Module headers can be omitted.
> >    If the module leaves out the module header, the header
> >       module Main(main) where
> >    is assumed.
> >    [and that's a mistake]
> 
> Fix the compilers.  If there's no module header, the compiler should
> not include the module name (Main) in the error messages.

That's be nice AS WELL but why not simplify the report by removing
 pointless defaults.

There's an argument going around that it must be possible teach Haskell
without having to mention the word "module" in the first month.
This argument is used to justify reexporting all kinds of rubbish
from the Prelude (and is something I have argued against in the Standard 
Haskell discussion).

[I know Fergus didn't make this argument - but it is related and it
irritates me enough that I'll answer it anyway.]

I think this argument is complete nonsense.  When I was taught 
{C,Ada,Modula2,Modula3,AssemblyLanguage,etc}, the first complete
program I ever saw contained some variant of #include <stdio.h>
and I had absolutely no problem with it and I have never heard of
anyone having a problem with it.

I just picked up my copy of K&R to see how they deal with it.
K&R spends just 4 lines explaining the #include and is, IMHO,
completely clear.  In fact, they even take the opportunity to
point you towards the appendix which describes stdio.h.  
If I pick up a Haskell textbook, how many pages will I have to
read before I'm told that the Prelude is a collection of 
declarations just like the ones I've been typing myself
and that it's possible to get a complete list of what's in
the Prelude.


In summary: 

  I've caught a few exceptions - let's kill them quick before they escape.


-- 
Alastair Reid              Yale Haskell Project Hacker
[EMAIL PROTECTED]  http://WWW.CS.Yale.EDU/homes/reid-alastair/



Reply via email to