GHC库中定义的Ord类在哪里?

时间:2018-03-03 13:09:27

标签: haskell ghc

GHC.Base的来源在开头有说明部分

The overall structure of the GHC Prelude is a bit tricky...
So the rough structure is as follows, in (linearised) dependency order


GHC.Prim        Has no implementation.  It defines built-in things, and
                by importing it you bring them into scope.
                The source file is GHC.Prim.hi-boot, which is just
                copied to make GHC.Prim.hi

GHC.Base        Classes: Eq, Ord, Functor, Monad
                Types:   list, (), Int, Bool, Ordering, Char, String

但是,虽然在该源文件中定义了Ordering,但Ord却没有。 Prelude doc页面没有Ord的源链接。实际定义在哪里?

1 个答案:

答案 0 :(得分:4)

Ord(和Eq)在GHC.Classes模块(由GHC.Base导入)中从ghc-prim包中定义(这是一个依赖项) of base )。