Where is the type of restriction determined?

I am not familiar with the internal components of GHC, but I have a couple of questions about ConstraintKinds.

It says GHC.Extsthat

data Constraint :: BOX

which is misleading because it Constraintis a kind of species BOX. This brings us to the first question: can we import and export species? How it works?

Please correct me for this next part if I completely disconnect. Due to the fact that I am trying to use different import resources and looking at the source in the hack, I assume that it GHC.Extsimports Constraintfrom GHC.Base, which, in turn, imports it from GHC.Prim. But I do not see where it is defined in GHC.Prim?

+4
source share
1 answer

As far as I know, there is no definition in any Haskell source file Constraint. This is a built-in network-connected name that is defined as belonging GHC.Primto the GHC sources themselves. Therefore, in particular, Constraintit is not an advanced data type; there is no corresponding data type of the kind *that is called Constraint.

There are other types in the GHC that are handled similarly, for example AnyK, OpenKindor even BOX.

GHC really doesn't really matter much inside between data types and types and something higher. That is why they, for example, are all displayed as being defined using data, albeit with different target views.

Note that in relation to GHC we also have

data BOX :: BOX

, "" - BOX.

, / . , ,

import GHC.Exts (OpenKind, BOX, Constraint)

. ,

x :: Constraint
x = undefined

, , , * , / BOX.

, , , , , : ., , https://ghc.haskell.org/trac/ghc/wiki/NoSubKinds .

+7

All Articles