Translation of GHC typechecker output to haskell-src-exts's 'Type'

Tom Sydney Kerckhove syd.kerckhove at gmail.com
Sat Apr 1 21:59:12 UTC 2017


Dear GHC Devs,

Because of the unwieldy nature of the data that the GHC type checker
outputs, I am trying to convert a GHC 'Type' [1] to a haskell-src-ext
'Type' [2].

The translation does not need to be perfect for now, but I would at
least like to be able to translate function types and types that involve
type-class constraints. (See my initial attempt in attachment)

Has this ever been done before?
Could you point me to some documentation on GHC's 'Type' [1] that could
help me with writing this function? (The comments in code aren't nearly
enough for me.)

In particular, I am having trouble finding type class constraints in the
'Type'.

Thank you for your time.

[1]: https://downloads.haskell.org/~ghc/8.0.2/docs/html/libraries/ghc-8.0.2/src/TyCoRep.html#Type
[2]: https://hackage.haskell.org/package/haskell-src-exts-1.18.2/docs/Language-Haskell-Exts-Syntax.html#t:Type

-- 
Tom Sydney Kerckhove
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attempt.hs
Type: text/x-haskell
Size: 1751 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170401/868ea61a/attachment.hs>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170401/868ea61a/attachment.sig>


More information about the ghc-devs mailing list