Finding & assembling class dictionaries from GHC plugins?

Nicolas Frisby nicolas.frisby at
Tue Nov 5 14:36:14 UTC 2013

On Nov 5, 2013 3:14 AM, "Simon Peyton-Jones" <simonpj at> wrote:

> A core-level plug-in can’t generate fresh instances.  There are some new
plug-in hooks that fit earlier in the pipeline, which can.  Maybe you can
use that, and generate a data type decl with “deriving Typeable”?

We're willing to do some awkward shoehorning in HERMIT to make this work in
limited circumstances. (Hopefully including Conal's.)

We just don't know how to start — ie how call the right functions from the
type checker. Are there any resources explaining the relevant subset of the


> From: ghc-devs [mailto:ghc-devs-bounces at] On Behalf Of Conal
> Sent: 04 November 2013 20:08
> To: ghc-devs at
> Subject: Finding & assembling class dictionaries from GHC plugins?
> I'm working on a GHC plugin (for compiling Haskell to hardware), and I
need to synthesize Typeable (and maybe other) class dictionaries for a wide
range of types, including composite types (functions, pairs, lists, etc).
Can it be done, and how? I think I'm mainly looking for mechanics of
finding existing class instances (however they're defined) and assembling
them (for parametrized/composite dictionaries), rather than mechanisms
specific to Typeable.
> Thanks, -- Conal
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list