Re: Tracking down instances from use-sites

2018-06-26 Thread Christopher Done
Ben, Thanks for the in-depth elaboration of what Mathew/Simon were describing! It seems within reach! > Of course, in the case that you have a concrete dictionary you *also* > want to know the source location of the instance declaration from which > it arose. I'm afraid this may be quite

Re: Tracking down instances from use-sites

2018-06-26 Thread Ben Gamari
Christopher Done writes: > Hi all, > > Given a TypecheckedModule, what's the most direct way given a Var > expression retrieved from the AST, to determine: > > 1) that it's a class method e.g. `read` > 2) that it's a generic call (no instance chosen) e.g. `Read a => a -> String` > 3) or if it's

Re: Tracking down instances from use-sites

2018-06-26 Thread Matthew Pickering
Sorry, they are not "frontend plugins" but a new feature that will be in GHC 8.6. They are an implementation of this GHC proposal. https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0017-source-plugins.rst There is also this thread last year about the same topic which Simon

Re: Tracking down instances from use-sites

2018-06-26 Thread Matthew Pickering
Chris, I have also considered this question. 1. Look at the `idDetails` of the `Id`. A class selector is a `ClassOpId`. 2,3, When a class selector `foo` is typechecked, the instance information is of course resolved. The selector `foo` is then wrapped in a `HsWrapper` which when desugared will

Tracking down instances from use-sites

2018-06-26 Thread Christopher Done
Hi all, Given a TypecheckedModule, what's the most direct way given a Var expression retrieved from the AST, to determine: 1) that it's a class method e.g. `read` 2) that it's a generic call (no instance chosen) e.g. `Read a => a -> String` 3) or if it's a resolved instance, then which instance