Haskell Language Hiding Imports


Example

Prelude often defines functions whose names are used elsewhere. Not hiding such imports (or using qualified imports where clashes occur) will cause compilation errors.

Data.Stream defines functions named map, head and tail which normally clashes with those defined in Prelude. We can hide those imports from Prelude using hiding:

import Data.Stream -- everything from Data.Stream
import Prelude hiding (map, head, tail, scan, foldl, foldr, filter, dropWhile, take) -- etc

In reality, it would require too much code to hide Prelude clashes like this, so you would in fact use a qualified import of Data.Stream instead.