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

Achim Schneider barsoap at web.de
Tue Nov 4 08:52:49 EST 2008


Maur____cio <briqueabraque at yahoo.com> wrote:

> 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 Foo(bar, Baz, Quux(..)) as F

(or even using "qualified") instead of using "hiding", it may be more
verbose but is way less confusing. Actually, I usually just write

import qualified Foo as F

and don't ever have to worry about name clashes.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.




More information about the Haskell-Cafe mailing list