<div dir="ltr">Hello,<div><br></div><div>I started adding custom solving for `Typeable` constraints, to work around the problem where kind parameters were missing from the representation of types. </div><div><br></div><div>The idea is as follows:</div><div><br></div><div>  1. Add a new filed to `<font face="monospace, monospace">TypeRep</font>` that remembers _kind_ parameters:</div><div><br></div><div>      <font face="monospace, monospace">TypeRep Fingerprint TyCon [TypeRep]{-kinds-} [TypeRep]{-types-}</font></div><div><br></div><div>  2. Modify the constraint solver, to solve constraints like this:</div><div>     - Kind-polymorphic type constructors don't get `<font face="monospace, monospace">Typeable</font>` instances on their own</div><div>     - GHC can solve `<font face="monospace, monospace">Typeable</font>` constraints on  _<i>concrete uses</i>_ of polymorphic type constructors.</div><div>      More precisely, GHC can solve constraints of the form `<font face="monospace, monospace">Typeable k (TC @ ks)</font>`, as long as:</div><div>       (1) `<font face="monospace, monospace">k</font>` is not a forall kind,</div><div>       (2) the `<font face="monospace, monospace">ks</font>` are all concrete kinds (i.e., they have no free kind variables).</div><div><br></div><div>This all seems fairly straight-forward, but I got stuck on the actual implementation, in particular:</div><div><br></div><div><b>what `<font face="monospace, monospace">EvTerm</font>` should I use when discharging a `<font face="monospace, monospace">Typeable</font>` constraint?</b></div><div><br></div><div>I can create a an `<font face="monospace, monospace">HsSyn</font>` value for the required method (i.e., a function of type `<font face="monospace, monospace">Proxy# t -> TypeRep</font>`).</div><div>I can also cast this into a `<font face="monospace, monospace">Typeable</font>` dictionary value.</div><div>The issue is that I am left with an `<font face="monospace, monospace">HsSyn</font>` expression, and not an `<font face="monospace, monospace">EvTerm</font>`.</div><div><br></div><div>So is there a way to treat an arbitrary expression as an `EvTerm`?</div><div><br></div><div>In the implementation of the type-lits, I just added custom evidence, but this does not scale well (also, in that case the evidence is just a simple value, while here</div><div>it is a bit more complex).</div><div><br></div><div>Suggestions would be most appreciated!</div><div><br></div><div>-Iavor</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>