Version française
Home     About     Download     Resources     Contact us    
Browse thread
warning on value shadowing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list2@d...>
Subject: Re: [Caml-list] warning on value shadowing
Jacques Garrigue wrote:

> Haskell has types too, but it also has overloading, which confuse
> things a bit, and IIRC there are no qualified identifiers, when you
> want to make explicit which definition you want to use.

You can import in Haskell as qualified, which is frequently done with
shorter names.

  import qualified LongName as L

and then use L.foo

It also allows other tricks such as
  import qualified LongName as L
  import LongName (baz)

which will import the symbol 'baz' from LongName, and the rest of
LongName is accessed qualified (L.foo).

This kind of stuff can be done in OCaml too, but gets tedious,
especially with types.

The other odd difference is that in Haskell, importing puts the names
into the current module.  If the current module is exporting
everything, then these names will be exported from it as well.

Dave