Sigh, I'll use a bigger smiley next time...


> The Haskell Report is very vague about this.

No, the report is quite clear about it and Hugs is wrong.

The report clearly says that 

  import qualified Foo(x)

makes Foo.x visible but does not make Foo.y visible.

It also clearly says that 

   import Foo ( blah )

implicitly performs

   import qualified Foo ( blah )

as well.

Incidentally, I think the implicit qualified import is a mistake.
Other problems in Haskell are:

o no clear specification of how import-export interacts with fixity
  (I sometimes manage to convince myself that Hugs' implementation
  of fixity follows the letter of the report - even though it
  clearly violates the spirit of the report.)

o fixity decls are optional
  I see no point in this.  If you want to use something as an infix
  operator, you ought to give a decl that says so.

  The only reason not to do this is that it's be cool to by able to write:

    x `elemBy myEquality` xs

  which obviously wouldn't work if you had to declare the fixity of
  "elemBy myEquality"

o the precedence of a fixity decl is optional
  I see even less point in this.  You need to know that the precedence
  defaults to 9 to make sense of your decl - so why not say it?
  Does it really take so long to type the extra 2 characters?

o fixity decls apply to identifiers not to variables.

  That is, the fixity decl for elem (from the Prelude) applies
  to the local occurence of elem - not just to Prelude.elem

    let elem xs x = Prelude.elem x xs in [1..10] `elem` 42

  This isn't that big a deal because few people shadow top level
  names and fixity isn't really used that much.

o fixity decls must come at the top of a module
o import decls must come at the top of a module

[Hmmm, the above list has very little to do with Koen's mail.  So it goes.]

Alastair



Reply via email to