Re: [Haskell-cafe] Newbie Q: GHCi: Where “List” module is imported from?

Jules Bean jules at
Fri Feb 16 11:59:36 EST 2007

Dmitri O.Kondratiev wrote:
> "Set" module here is built with list and uses among other things list 
> comparison functions such as (==) and (<=).
> Q1:  Where "List" module is imported from?
> GHC "Base" package contains "Data.List" module, not just "List" module.

List was the old name for it. Data.List is the new name.
> Besides,  "Data.List" does not have (<=) function.

Actually, lists are partly defined in the Prelude, with auxiliary 
functions in Data.List. In particular, <= for List is defined in the 
Prelude. Or rather, I should say, the Ord instance for lists is defined 
in the prelude (and only if the type inside the lists is itself an Ord 
instance). Look:

Prelude> [1,2] <= [3,4]

(Lists of ints have the lexicographic ordering based on the standard 
ordering on integers)

Prelude> [id] <= [id]

    No instance for (Ord (a -> a))
      arising from use of `<=' at <interactive>:1:5-6

(Lists-of-functions aren't Ordered, because functions aren't Ordered)


More information about the Haskell-Cafe mailing list