haskell - Where is the Constraint kind defined? -
haskell - Where is the Constraint kind defined? -
i'm not familiar ghc internals have couple questions constraintkinds.
it says ghc.exts that
data constraint :: box which misleading because constraint kind of sort box. brings first question: can import , export kinds? how work?
please right me on next part if i'm totally off. trying out different imports , glancing around @ source on hackage, guess ghc.exts imports constraint ghc.base, in turn, imports ghc.prim. not see defined in ghc.prim?
to knowledge, there no definition of constraint in haskell source file. it's built-in, wired-in name defined belong within ghc.prim in ghc sources itself. in particular constraint not promoted datatype, there's no corresponding datatype of kind * called constraint.
there other kinds in ghc treated similarly, such anyk, openkind or box itself.
ghc doesn't create big difference internally between datatypes , kinds , above. that's why e.g. show beingness defined using data albeit different target kinds.
note far ghc concerned, have
data box :: box it's impossible user straight define new "kinds" of super-kind box, though.
as far know, importing / exporting makes no difference between type , kind namespaces. e.g.
import ghc.exts (openkind, box, constraint) is legal. in fact, if say
x :: constraint x = undefined you don't scope error, kind error, saying type of kind * expected, type/kind of kind box provided.
i should perhaps whole story kinds in flux, , there proposals beingness discussed alter bit: see e.g. https://ghc.haskell.org/trac/ghc/wiki/nosubkinds related discussion.
haskell ghc constraint-kinds
Comments
Post a Comment