Tom
Please start a wiki page, somewhere under
https://ghc.haskell.org/trac/ghc/wiki/Commentary
that gives the information you wish was more clearly described.
And/or add a Note in TyCoRep to explain.
My answer to your question would be:
The type that Haskell programmers write
Ord a => a -> a
is represented in Type using FunTy, thus
Ord a -> a -> a
There is no "=>" data contructor.
Instead you can tell the difference between -> and => by looking at the kind of
the bit before the ->. Thus
ty1 -> ty2
if ty1 :: Constraint, then it it's a "=>" otherwise a "->".
Use (isPredTy ty1) to tell the difference.
Does that help
Simon
| -----Original Message-----
| From: ghc-devs [mailto:[email protected]] On Behalf Of Tom
| Sydney Kerckhove
| Sent: 02 April 2017 14:02
| To: Ben Gamari <[email protected]>
| Cc: [email protected]
| Subject: Re: Translation of GHC typechecker output to haskell-src-
| exts's 'Type'
|
| On 02-04-17 14:40:05, Tom Sydney Kerckhove wrote:
| > Is there a way to access the types before this translation happens?
| > It's okay if I have to assume that type-checking succeeds...
|
| I have found a way to do what I want, even after this translation.
| It relies on the fact that type class constraints always occur on the
| left side of the result of splitFunTy.
|
| Thank you for your help!
|
| --
| Tom Sydney Kerckhove
_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs