Constructing coercions for associated type?

2014-05-25 Thread Conal Elliott
I'm working on a GHC plugin in which I need to programmatically construct a coercion for an associated type, given the type function name and the type argument. For instance, I have the following class: > class Encodable a where > type Encode a > encode :: a -> Encode a > decode :: Encode a

Re: Constructing coercions for associated type?

2014-05-25 Thread Richard Eisenberg
Does FamInstEnv.normaliseType work for you? FamInstEnv is in the types/ directory. FamInst.tcGetFamInstEnvs may also be helpful. FamInst is in the typecheck/ directory. Richard On May 25, 2014, at 12:42 PM, Conal Elliott wrote: > I'm working on a GHC plugin in which I need to programmatically

Re: Constructing coercions for associated type?

2014-05-25 Thread Conal Elliott
Looks perfect. It'll take some time to put the pieces together, but I think it'll work. Thanks, Richard!-- Conal On Sun, May 25, 2014 at 11:42 AM, Richard Eisenberg wrote: > Does FamInstEnv.normaliseType work for you? FamInstEnv is in the types/ > directory. FamInst.tcGetFamInstEnvs may also