What does 'qualified' mean in 'import qualified Data.List' statement?

后端 未结 3 1352
一整个雨季
一整个雨季 2020-12-14 06:17

I understand import Data.List.

But what does qualified mean in the statement import qualified Data.List?

3条回答
  •  误落风尘
    2020-12-14 07:03

    The keyword qualified means that symbols in the imported modules are not imported into the unqualified (prefixless) namespace. They are only available with their full qualified name. For instance, foldr' has the unqualified name foldr' and the qualified name Data.List.foldr'.

    One uses qualified imports to prevent namespace pollution. It is also possible to use import qualified Foo as Bar, which imports from Foo but with names as if the import stems from Bar. For instance, if you type import qualified Data.List as L, you can use foldr' as L.foldr'.

提交回复
热议问题