<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi Jan,</div><div class=""><br class=""></div>mkAlgTyCon is good for making an algebraic datatype -- like Maybe or Bool or Either. It's not what you want for RNil, which is really a data constructor. Instead, rowKindCon should be the algebraic datatype, and RNil should be one of its constructors. Then you get the RNil TyCon via promotion, as Matt suggested.<div class=""><br class=""></div><div class="">I hope this helps!</div><div class="">Richard<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 3, 2019, at 7:06 AM, Jan van Brügge <<a href="mailto:jan@vanbruegge.de" class="">jan@vanbruegge.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><div class="">
<br class="webkit-block-placeholder"></div>
<div class="moz-text-plain" wrap="true" style="font-family:
-moz-fixed; font-size: 12px;" lang="x-unicode">
<pre class="moz-quote-pre" wrap="">Hi,
when trying to get familiar with the GHC code base for my Bachelor's
thesis. I followed the GHC Wiki, especially the case study about the
bool type.
Now I wanted to add a new kind and a new type inhabiting this kind
(without having to expose a data constructor, so without datatype
promotion).
So in TysWiredIn.hs I added the new TyCons and added them to the list of
wired-in types:
-- data Row a b
rowKindCon :: TyCon
rowKindCon = pcTyCon rowKindConName Nothing [alphaTyVar, betaTyVar] []
rowKind :: Kind
rowKind = mkTyConTy rowKindCon
-- data RNil :: Row a b
rnilTyCon :: TyCon
rnilTyCon = mkAlgTyCon rnilTyConName [] rowKind [] Nothing []
(mkDataTyConRhs [])
(VanillaAlgTyCon (mkPrelTyConRepName rnilTyConName))
False
rnilTy :: Type
rnilTy = mkTyConTy rnilTyCon
I also added two new empty data decls to ghc-prim, but if I inspect the
kind of RNil it is not Row, but Type. So I think I am either
understanding res_kind wrong or I have to do something completely different.
I am also not sure how to verify that the code in TysWiredIn.hs is
working at all, from all what I can tell it could just be the
declarations in ghc-prim that result in what I see in ghci.
Thank you and sorry for my beginner question
Jan
</pre>
</div>
</div>
_______________________________________________<br class="">ghc-devs mailing list<br class=""><a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br class=""></div></blockquote></div><br class=""></div></body></html>