Accessing the "original" names via GHC API

Joachim Breitner mail at joachim-breitner.de
Wed Jan 25 02:11:35 UTC 2017


Hi Ranjit,

Am Dienstag, den 24.01.2017, 16:09 -0800 schrieb Ranjit Jhala:
> My goal is to write a function
> 
>    tyconString :: TyCon -> String 
> 
> (perhaps with extra parameters) such that given the 
> `TyCon` corresponding to `Set`, I get back the "original" 
> name `S.Set`, or even `Data.Set.Set`. 
> 
> Everything I've tried, which is fiddling with different variants of
> `PprStyle`, end up giving me `Data.Set.Base.Set`
> 
> Does anyone have a suggestion for how to proceed?

in a way, `Data.Set.Base.Set` is the “original”, proper name for Set,
everything else is just a local view on the name.

So, are you maybe looking for a way to get the “most natural way” to
print a name in a certain module context?

This functionality must exist somewhere, as ghci is printing out errors
this way. But it certainly would require an additional argument to
tyconString, to specify in which module to print the name.

Greetings,
Joachim


-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20170124/70a41b2e/attachment.sig>


More information about the Glasgow-haskell-users mailing list