Constructing coercions for associated type?

Conal Elliott conal at conal.net
Sun May 25 22:00:03 UTC 2014


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 <eir at cis.upenn.edu>wrote:

> 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 <conal at conal.net> wrote:
>
> > 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 -> a
> >
> > along with a type instance, say `Int -> Bool`. In a GHC plugin, how can
> I apply a type function to an argument type to get back the resulting type
> and the associated coercion? (Given the latter, I think the former comes
> from `coercionKind`).
> >
> > -- Conal
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://www.haskell.org/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140525/a9df47f7/attachment.html>


More information about the ghc-devs mailing list