<div dir="ltr">Sorry, I messed up subject and mailing list. Copying to both list now after the mistake (wanted only ghc-devs for specificity).<div><br></div><div>Thanks!<br><div class="gmail_extra"><br><div class="gmail_quote">2017-09-19 7:36 GMT+02:00 Robin Palotai <span dir="ltr"><<a href="mailto:palotai.robin@gmail.com" target="_blank">palotai.robin@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello GHC devs,<div><br></div><div>Before inventing the wheel, want to check if there is a GHC API way to look up the (fully) resolved instance method from a class method.</div><div><br></div><div>For example, given a code</div><div><br></div><div>    data Foo Int deriving Show</div><div><br></div><div>    bar = show (Foo 3)</div><div><br></div><div>when inspecting the Typechecked AST for bar's show call, I would like to get to the Name / Id of 'show' of the 'Show' typeclass.</div><div><br></div><div>I believe I could use splitHsSigmaTy on the HsType of the function call to get the context, and then evaluate the HsWrapper somehow to find out what instance dictionary is applied to the class restriction in the context, and then look up the instance method from the dictionary..</div><div><br></div><div>Two questions:</div><div><br></div><div>1) Is there maybe functionality for this?</div><div><br></div><div>2) If not, is there any guarantee about the constraint order in the context, at the method call? So I could more easily determine which constraint's application to look for..</div><div><br></div><div>Any hints welcome && Thank you!</div><span class="HOEnZb"><font color="#888888"><div>Robin</div></font></span></div>
</blockquote></div><br></div></div></div>