haskell - Is there a reason we can't populate types with DataKinds? -
haskell - Is there a reason we can't populate types with DataKinds? -
with datakinds, definition like
data kfoo = tfoo
introduces kind kfoo :: box
, type tfoo :: kfoo
. why can't go on define
data tfoo = cfoo
such cfoo :: tfoo
, tfoo :: kfoo
, kfoo :: box
?
do constructors need belong type belongs kind *
? if so, why?
edit: don't error when this, because constructors , types share namespace, ghc permits conflicts because disambiguates names regular types, rather promoted constructors. docs prefix '
refer promoted constructor. when alter sec line to
data 'tfoo = cfoo
i error
malformed head of type or class declaration: tfoo
do constructors need belong type belongs kind *
?
yes. that's *
means: it's kind of (lifted / boxed, i'm never sure part) haskell types. indeed other kinds aren't kinds of types though share type
syntax. rather *
metatype-level type types, , other kinds metatype-level types things aren't types type constructors or different.
(again, there's unboxed-type kinds; types think isn't possible data
constructor.)
haskell data-kinds
Comments
Post a Comment