Set, Map libraries

Robert van Herk rherk at cs.uu.nl
Thu Jun 2 03:48:33 EDT 2005


>6. My module applies  Data.Set.null (s :: Set a),
>   and                         null (xs :: [a]).
>
>  Why ghc reports of the clash with  GHC.List.null ?
>  Is  GHC.List  same as old  List  library module?
>  Should I write
>                 import GHC.List (genericLength, null)
>  instead of     import List     (genericLength)
>  ?
>  
>
As the documentation reads:

This module is intended to be imported qualified, to avoid name clashes 
with Prelude 
<http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html> 
functions. eg.

  import Data.Set as Set



So, you should write:

import qualified Data./x/ as /y/

Now, no name clashes will occur. However, you will have to write 
/y/.null to access null in /x/, for example:

import qualified Data.Set as Set

if (Set.null ...) then ... else ...

Regards,
Robert


More information about the Glasgow-haskell-users mailing list