{"id":402,"date":"2022-08-30T15:00:45","date_gmt":"2022-08-30T15:00:45","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/automatic-heq-instances-for-members-of-an-hlist-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:00:45","modified_gmt":"2022-08-30T15:00:45","slug":"automatic-heq-instances-for-members-of-an-hlist-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/automatic-heq-instances-for-members-of-an-hlist-collection-of-common-programming-errors\/","title":{"rendered":"Automatic HEq instances for members of an HList-Collection of common programming errors"},"content":{"rendered":"<p>There are several flavors of HList&#8217;s labels. You are trying to use your own &#8216;ATag&#8217; and &#8216;BTag&#8217; phantoms as labels. The HList flavor you are using expects its &#8216;HNat&#8217; types as labels: &#8216;HZero&#8217; and &#8216;HSucc *&#8217;.<\/p>\n<p>You need to import one of the Data.HList.Label1 to Label5 modules. And you will need to choose a TypeEq flavor, and the TypeCast flavor to match the TypeEq flavor:<\/p>\n<pre><code>{-# LANGUAGE TypeOperators #-}\n\nimport Data.HList\nimport Data.HList.Label5\nimport Data.HList.TypeCastGeneric1\nimport Data.HList.TypeEqGeneric1\n\ndata ATag\ndata BTag\n\ntype TagList = ATag :*: BTag :*: HNil\n\nbIndex :: Int\nbIndex = hNat2Integral (hFind (undefined :: BTag) (undefined :: TagList))\n<\/code><\/pre>\n<p>The above works and give &#8216;bIndex&#8217; the value 1.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 19:01:41. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>There are several flavors of HList&#8217;s labels. You are trying to use your own &#8216;ATag&#8217; and &#8216;BTag&#8217; phantoms as labels. The HList flavor you are using expects its &#8216;HNat&#8217; types as labels: &#8216;HZero&#8217; and &#8216;HSucc *&#8217;. You need to import one of the Data.HList.Label1 to Label5 modules. And you will need to choose a TypeEq [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}