<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 18, 2015, at 12:19 PM, Jan Bracker <<a href="mailto:jan.bracker@googlemail.com">jan.bracker@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">As far as I understand your explanation this should not lead to an error, although it is not the most obvious coercion. Is that right?</div></blockquote><div><br></div><div>That's what it seems to be, in this particular case. But I'd be nervous with this result and would want further examination. My next port of call in your shoes would be to run with -ddump-tc-trace. I'm afraid I don't have the time right now to walk through that with you, though -- sorry!</div><div><br></div><div>Richard</div><br><blockquote type="cite"><div dir="ltr"><div><br></div><div>Do you or anybody else have a suggestion on how to resolve this issue?<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-18 17:13 GMT+00:00 Richard Eisenberg <span dir="ltr"><<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Ah yes. I looked too quickly. Note that there are two NthCo's listed. Its the outermost that's the problem, which is deconstructing the Union. But it's doing so to prove that '["thres" :-> Int] ~ '["thres" :-> Int] which is rather easy to prove without NthCo. I'm not sure why GHC is doing this.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Richard</div></font></span><div><div class="h5"><br><div><div>On Nov 18, 2015, at 12:11 PM, Jan Bracker <<a href="mailto:jan.bracker@googlemail.com" target="_blank">jan.bracker@googlemail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Richard,<div><br></div><div>No "Split" is a class and is defined here: <a href="http://hackage.haskell.org/package/effect-monad-0.6.1/docs/Control-Effect-State.html#t:Split" target="_blank">http://hackage.haskell.org/package/effect-monad-0.6.1/docs/Control-Effect-State.html#t:Split</a></div><div>"Union" is a type function (synonym that refers to a type function call): <a href="http://hackage.haskell.org/package/effect-monad-0.6.1/docs/Control-Effect-Writer.html#t:Union" target="_blank">http://hackage.haskell.org/package/effect-monad-0.6.1/docs/Control-Effect-Writer.html#t:Union</a></div><div><br></div><div>thank you for your quick reply!</div><div><br></div><div>Best,</div><div>Jan</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-18 17:05 GMT+00:00 Richard Eisenberg <span dir="ltr"><<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I took just a quick look at this. Is Split a type family? The NthCo coercion form takes apart a composite equality into its pieces. For example, if we know (Maybe a ~ Maybe b), then NthCo:0 will tell us that (a ~ b). In your case, it looks like GHC is trying to deduce (Union '["thres" :-> Int] []) ~ (Union '["thres" :-> Int] (Unit Reader)) from an equality of two (Split ...) types. If Split is a type family, this deduction is unsound. That may be what Core Lint is worried about.</div><div><br></div><div>I'm not surprised that the executable would run with an error. But it might not in the future. If -dcore-lint fails, it means that there is a potential type safety issue in the Core code, and this should be taken seriously.</div><div><br></div><div>I hope this helps!</div><div>Richard</div><br><div><div><div>On Nov 18, 2015, at 11:35 AM, Jan Bracker <<a href="mailto:jan.bracker@googlemail.com" target="_blank">jan.bracker@googlemail.com</a>> wrote:</div><br></div><blockquote type="cite"><div><div dir="ltr">Hi,<div><br></div><div>I am using the type checker plugin interface and I am trying to produce some evidence for type class instances. During compilation of one of my examples I get this core-lint error:</div><div><br></div><div><div>*** Core Lint errors : in result of Simplifier ***</div><div><no location info>: Warning:</div><div> [RHS of ds_a6bY :: (Set '["thres" :-> Int], Set (Unit Reader))]</div><div> Bad getNth:</div><div> Nth:0</div><div> (Nth:2</div><div> (Sub (Sym (TFCo:R:Inv[]Readerfg[0] <'["thres" :-> Int]>_N <'[]>_N))</div><div> ; (Inv</div><div> <Reader>_N <'["thres" :-> Int]>_N (Sym TFCo:R:Unit[]Reader[0]))_R</div><div> ; Sub</div><div> (TFCo:R:Inv[]Readerfg[0] <'["thres" :-> Int]>_N <Unit Reader>_N)))</div><div> Split '["thres" :-> Int] '[] (Union '["thres" :-> Int] '[])</div><div> Split</div><div> '["thres" :-> Int]</div><div> (Unit Reader)</div><div> (Union '["thres" :-> Int] (Unit Reader))</div></div><div><br></div><div>I suppose "getNth" refers to the constructor "EvTupleSel" from "EvTerm", "TcNthCo" from "TcCoercion" or to "NthCo" from "Coercion". But I never produce evidence of the shape "getNth". My evidence production code can be found at [1] and the only place where evidence of this shape can come from is my "evaluateType" function [2] that calls "normaliseType" from the GHC module "FamInstEnv". You can reproduce the error by checking out commit 144525886ec107af6f1283b26b19f8125c980aa4 from [3] and running "make effect-example" in the top directory of the repository (GHC 7.10 or better is required and a sandbox is automatically created).</div><div><br></div><div>The core-lint error does not seem to have any negative consequences when ignored. The produced executable works fine. Can somebody explain why it appears and maybe how I can fix it?</div><div><br></div><div>Thank you!</div><div>Jan</div><div><br></div><div>[1] <a href="https://github.com/jbracker/polymonad-plugin/blob/144525886ec107af6f1283b26b19f8125c980aa4/src/Control/Polymonad/Plugin/Evidence.hs#L177" target="_blank">https://github.com/jbracker/polymonad-plugin/blob/144525886ec107af6f1283b26b19f8125c980aa4/src/Control/Polymonad/Plugin/Evidence.hs#L177</a></div><div>[2] <a href="https://github.com/jbracker/polymonad-plugin/blob/144525886ec107af6f1283b26b19f8125c980aa4/src/Control/Polymonad/Plugin/Evaluate.hs#L29" target="_blank">https://github.com/jbracker/polymonad-plugin/blob/144525886ec107af6f1283b26b19f8125c980aa4/src/Control/Polymonad/Plugin/Evaluate.hs#L29</a></div><div>[3] <a href="https://github.com/jbracker/polymonad-plugin" target="_blank">https://github.com/jbracker/polymonad-plugin</a></div></div></div>
_______________________________________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></blockquote></div><br></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>