class Ord 在 GHC 库中定义在哪里?
Where is class Ord defined in GHC library?
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 文档页面没有 Ord
的来源 link。它实际上在哪里定义?
Ord
(和Eq
)在GHC.Classes
module (which is imported by GHC.Base
) from the ghc-prim包中定义(它是base的依赖项)。
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 文档页面没有 Ord
的来源 link。它实际上在哪里定义?
Ord
(和Eq
)在GHC.Classes
module (which is imported by GHC.Base
) from the ghc-prim包中定义(它是base的依赖项)。