<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>