<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">Hello, I'm writing a type-checker plugin for ghc, and I'm stuck on two problems. I can't understand how does TcPluginContradiction work. My problem is, when I do TcPluginContradiction listOfFailedConstraints and run the plugin on something which should fail, compiler output contains strange errors for places which doesn't produce any errors when the rest type checks. And it can be seen from debug that listOfFailedConstraints does contain only the constraints that are expected to fail. </div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">For example my plugin should type check Set '[Int]) ~ Set '[Int, Int], and should not Set '[Int, Bool, Int] ~ Set '[Int]. And everything is great when I run it on the first case, but if I run it on the both first and second, the compiler output will contain «Couldn't match type ‘Set '[Int]’ with ‘Set '[Int, Int]’» and «Couldn't match type ‘Set '[Int, Bool, Int]’ with ‘Set '[Int]’».</div><div style="margin: 0px; line-height: normal; color: rgb(69, 69, 69);" class="">My ghc version is 8.2.2.</div><div style="margin: 0px; line-height: normal; color: rgb(228, 175, 10);" class=""><span style="color: rgb(69, 69, 69);" class="">Also how does ghc converts Type from <a href="https://hackage.haskell.org/package/ghc-8.2.1/docs/src/TyCoRep.html#Type" class=""><span style="color: rgb(228, 175, 10);" class="">https://hackage.haskell.org/package/ghc-8.2.1/docs/src/TyCoRep.html#Type</span></a> to Typeable/TypeRep from <a href="https://hackage.haskell.org/package/base-4.10.1.0/docs/src/Data.Typeable.Internal.html#TypeRep" class=""><span style="color: rgb(228, 175, 10);" class="">https://hackage.haskell.org/package/base-4.10.1.0/docs/src/Data.Typeable.Internal.html#TypeRep</span></a>? I’d like to use a function (if there exists one) that takes Type and returns its fingerprint (<a href="https://hackage.haskell.org/package/base-4.10.1.0/docs/src/GHC.Fingerprint.Type.html#Fingerprint" class=""><span style="color: rgb(228, 175, 10);" class="">https://hackage.haskell.org/package/base-4.10.1.0/docs/src/GHC.Fingerprint.Type.html#Fingerprint</span></a>). </span></div><div style="margin: 0px; line-height: normal; color: rgb(228, 175, 10);" class=""><span style="color: rgb(69, 69, 69);" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; color: rgb(228, 175, 10);" class=""><span style="color: rgb(69, 69, 69);" class="">Thank you for your time,</span></div><div style="margin: 0px; line-height: normal; color: rgb(228, 175, 10);" class=""><span style="color: rgb(69, 69, 69);" class="">Alice.</span></div></div></body></html>