[Haskell-cafe] Re: Syntax question regarding 'import'

Maurí­cio briqueabraque at yahoo.com
Tue Nov 4 11:54:24 EST 2008


 >> About this teste code:
 >>
 >> module Main (main) where {
 >> import Foreign hiding (unsafePerformIO,Foreign.Ptr,Data.Bits,) ;
 >> blo = xor 10 10 :: Int ;
 >> main = return ()
 >> }
 >>

 > You're only hiding the typeclass Data.Bits, not
 > the function xor. To do that, you have to write
 >
 > import Foreign hiding (unsafePerformIO,Data.Bits(..))
 >
 >
 > Generally, I'd use (...)
 > import qualified Foo as F
 > and don't ever have to worry about name clashes.

Agree. I'm asking this because I'm wrting my
syntax reference. Is that a GHC extension? Look at
this (from haskell 98 report sections 5.2 and
5.3):

export   -> qvar
          | qtycon [(..) | ( cname1 , ... , cnamen )]
          | qtycls [(..) | ( var1 , ... , varn )]
          | module modid

import   -> var
          | tycon [ (..) | ( cname1 , ... , cnamen )]
          | tycls [(..) | ( var1 , ... , varn )]

It seems 'modid's are included when exporting
names, but not when importing.

Maurício



More information about the Haskell-Cafe mailing list