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

问题描述 投票:3回答:1

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的源链接。实际定义在哪里?

haskell ghc
1个回答
4
投票

Ord(和Eq)在GHC.Classes模块(由GHC.Base导入)中定义自ghc-prim包(它是基础的依赖)。

© www.soinside.com 2019 - 2024. All rights reserved.