
On 01-04-17 19:47:15, Ben Gamari wrote:
Tom Sydney Kerckhove
writes: Dear GHC Devs,
Hi Tom,
Hi Mr Gamari
I'm afraid the notes in TyCoRep are really all we have. Note that you should also familiarize yourself with the TyCon type (for reasons you'll see below).
In particular, I am having trouble finding type class constraints in the 'Type'.
During typechecking class constraints are turned into dictionary arguments.
Oh, that's already done by then? It makes a lot more sense now why I get this: ghcs translation: Ord a -> [a] -> [a] haskell-src-exts: Ord a => [a] -> [a] I'm guessing that this 'Ord a' that I get, is the type of the dictionary for 'Ord' in the case of 'a'. Is there a way to access the types before this translation happens? It's okay if I have to assume that type-checking succeeds...
If I'm not mistaken you can pick these out by looking for AlgTyCons (a constructor of the TyCon type, see TyCon.hs) with a algTcParent matching (ClassTyCon cls _). cls will be the name of the associated class.
I hope this helps.
This does help, thank you!
Cheers,
Thank you for your time.
- Ben
-- Tom Sydney Kerckhove