Re: Type class instances in scope

2017-05-24 Thread Edward Z. Yang
Hi Tom, Here is what I was thinking when I made the suggestion: 1. Determine the transitive set of 'Module' that you need to load 2. Load each one using 'loadInterface' So, there are a few problems with your code below: - For external packages, it's sufficient to use 'loadInterface' to load

Re: Type class instances in scope

2017-05-21 Thread Tom Sydney Kerckhove
Hi Edward, I'm sorry to have to bother you with this again, but I seem to be stuck with this approach. I think I don't really understand what 'load the interfaces' means. Here's what I tried: ``` Haskell getInstancesFromTcmodule :: GhcMonad m => TypecheckedModule -> m ()

Re: Type class instances in scope

2017-05-19 Thread Tom Sydney Kerckhove
On 19-05-17 08:35:32, Edward Z. Yang wrote: > Excerpts from Tom Sydney Kerckhove's message of 2017-05-19 11:05:17 +0200: > > > But if you > > > really need all instances, you will have to first arrange to load > > > the interfaces of ALL modules transitively imported by your module. > > > > I

Re: Type class instances in scope

2017-05-19 Thread Edward Z. Yang
Excerpts from Tom Sydney Kerckhove's message of 2017-05-19 11:05:17 +0200: > Oh, that's annoying. > I have a feeling there is room for an optimisation here. > ... or maybe this was already an optimisation, I don't really know. It's an optimization. Without, we would have to eagerly load every

Re: Type class instances in scope

2017-05-19 Thread Tom Sydney Kerckhove
On 18-05-17 20:41:13, Edward Z. Yang wrote: > Hi Tom, Hi Edward, > The problem is that GHC lazily loads non-orphan instances, so they won't > be in the environment until you load the interface which would have > caused the instance to come into scope. Oh, that's annoying. I have a feeling there

Re: Type class instances in scope

2017-05-18 Thread Edward Z. Yang
Hi Tom, The problem is that GHC lazily loads non-orphan instances, so they won't be in the environment until you load the interface which would have caused the instance to come into scope. I'm not sure exactly what you are actually trying to do. But if you really need all instances, you will

Type class instances in scope

2017-05-18 Thread Tom Sydney Kerckhove
Dear GHC Devs. I am trying to use the GHC API as part of the work that I am doing for my thesis. Currently I am looking for a way to find all the type class instances that are in scope in a given module. Here's what I've tried: ``` getInstancesFromTcmodule :: GhcMonad m =>