On the Standard Haskell site,
Alastair Reid wrote:
> One of the goals of Standard Haskell was to simplify the language
> - removing traps and making it easier to teach/learn. We've seen
> very little work on this, so I'd like to make the following proposal:
>
> Let's remove all the little syntactic shortcuts which only save
> a few characters but require you to understand something new
> or to learn what the default is.
>
> 1) Fixity declarations usually look like this:
>
> infixl 6 +, -
>
> but you can omit the precedence digit and write this instead:
>
> infixl +, -
>
> The programmer who uses this avoids having to type 2 characters.
> The programmers who'sre reading this code has to learn that
> the precedence digit can be omitted (I didn't believe it when I
> first saw it) and then look up the default precedence in the report.
> I think it is harder to understand programs that use this shortcut
> and that it should be removed.
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.
> 2) Deriving lists come in two flavours:
>
> data ... deriving Eq
> data ... deriving (Eq,Ord)
...
> I think we should eliminate the first style.
I could live with that.
> 3) Empty contexts are not allowed.
>
> It's fine to write:
>
> f :: (Ord a) => a -> a -> Bool
>
> but you can't write:
>
> f :: () => a -> a -> Bool
>
> I think we should relax the syntax to allow empty contexts.
Who would ever write them?
Even for programs that generate Haskell code, it's trivial to handle
the empty context case differently.
> 3) Contexts come in two flavours:
>
>
> f :: Ord a => a -> a -> Bool
>
> and
>
> f :: (Ord a, Bounded a) => a -> a -> Bool
>
> Again, we save 2 characters but then we have to explain both forms of
> syntax. And, again, it's inconsistent to let you omit the parens in
> contexts but force you to put them in in import-export lists.
>
> Change: delete one line from the grammar and half a sentence from 4.1.2.
I could live with that, but it might break a lot of existing code.
> 4) Module headers can be omitted.
>
> If the module leaves out the module header, the header
>
> module Main(main) where
>
> is assumed.
>
> This saves 23 characters of typing (17 if you omit the export list, 14
> if you call the module A instead). When teaching Haskell, you still have
> to explain about modules because your Haskell compiler will refer to the
> module "Main" in error messages.
Fix the compilers. If there's no module header, the compiler should
not include the module name (Main) in the error messages.
> 5) Lists of constructors can be empty in export lists but can't
> be empty in import lists.
...
> I think this is a simple typo.
>
> Change: replace n>=1 with n>=0 in the grammar rule for import.
This one I support.
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.