<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; "><div>Hi Jack,</div><div><br></div><div>You're spot on here. And, looking through #9173, I wouldn't expect this to be an easy change, precisely for the reason you articulate here. You could change the TypeEqOrigin constructor of CtOrigin (in TcRnTypes.hs) to also carry the expression, except that sometimes even that will be hard. In unrelated work, I needed to do precisely this, and needed to use something like (Maybe (HsExpr TcId)).</div><div><br></div><div>In any case, this isn't newcomer material, I'm afraid. You're welcome to keep trying, but I think your energy is better spent elsewhere for a few bugs and then to return here with a little more experience working with GHC. If you want type-checker related bugs, you could always look through the first section of my pet page of such things: <a href="https://ghc.haskell.org/trac/ghc/wiki/Status/RAE-Tickets">https://ghc.haskell.org/trac/ghc/wiki/Status/RAE-Tickets</a> But even things listed there as "easy" mean that they may be easy for someone who knows GHC well, but not so much for a newcomer.</div><div><br></div><div>Thanks for contributing!</div><div><br></div><div>Richard</div><br><div><div>On Aug 8, 2015, at 10:56 PM, Jack Bowman <<a href="mailto:johnrbowman@gmail.com">johnrbowman@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi all,<br>I'm new to the GHC codebase and am looking to contribute. I started trying to implement <a href="https://ghc.haskell.org/trac/ghc/ticket/9173">https://ghc.haskell.org/trac/ghc/ticket/9173</a> , "better type error messages". I'm having some difficulty and was hoping someone more experienced could point me in the right direction.<br>Part of the proposed change is that the "inferred:" line lists both the expression ("Just 5") and its type ("Maybe a0"). That's good because it's more clear that way. Currently those are in different parts of the error message. The function misMatchMsg (TcErrors.hs) creates the text "couldn't match expected type...". The text "In the second argument of..." is created by funAppCtxt (TcExpr.hs) during type checking. Bringing these together seems tricky. When we're generating a message like "couldn't match expected type..." I don't see how to access the expression text, like the "LHsExpr Name"s available to funAppCtxt. Is there an easy way to get that? We have the constraint and the two types, but I don't think those include this info.<br>It seems fundamental to the error messages that the context ("in the _ argument..., in the expression ...") is built up as *text* while we do type checking, which means it's hard to customize when building the final error message.<br>Please let me know if I'm missing something. There's a lot of type checker state that I might be misunderstanding.<br>Thanks,Jack</div>
_______________________________________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br></blockquote></div><br></body></html>