[Haskell-beginners] Down in Data.Ord vs GHC.Exts

Andres Löh andres at well-typed.com
Tue Apr 16 09:45:12 CEST 2013


Hi Matthrw.

> While attempting to do some sorting, I ran across Down. The docs:
> http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Ord.html#t:Down
> say it's in Data.Ord, but GHCi 7.4.1 complains the Down data constructor
> isn't in scope, but if I import GHC.Exts
> (http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Exts.html#t:Down),
> I get the constructor I expect.
>
> Are the docs wrong? Or is there something I'm not doing right to get Down
> exported from Data.Ord? Or other things to check?

The docs are not wrong, but you are looking at the "latest" docs, and
are using ghc-7.4.1. If you check

  http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Ord.html

(where base-4.5.0.0 is the version of base shipping with ghc-7.4.1),
then you'll see that is exports an instance of Ord for Data.Exts.Down,
but does not include Down. Since ghc-7.6 (or base-4.6.0.0), the module
Data.Ord defines Down.

Rather than figuring out the base version you're using via "ghc-pkg",
you can also look at the Haskell Platform documentation for the
version of the platform you're using. In this case, probably,

  http://lambda.haskell.org/platform/doc/2012.2.0.0/

and then look for Data.Ord in the module hierarchy in there.

Cheers,
  Andres

-- 
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com



More information about the Beginners mailing list