Pasqualino "Titto" Assini | 4 Jul 19:11 2013
Picon

getting exported original names using the GHC API

Say that I have a module like:


module Test(L.find) where

import Data.List as L


Using the GHC API, I extract the module exports (using GHC.modInfoExports) and I get a list of names.

Now, I want to get the name of the export with the namespace stated in the source ("L.find")  but I seem to be able to get it only as "Data.List.find".

I have tried different variations of functions on Name or OccName but nothing seems to work.

Obviously, I could just parse the module and get the info that way, but I wondered if it could be done via the API.

Thanks,

    titto

--
Dr. Pasqualino "Titto" Assini
http://quid2.org/

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
AlanKim Zimmerman | 4 Jul 20:25 2013
Picon

Re: getting exported original names using the GHC API

If you use the ParsedSource representation,  http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-7.6.3/HsSyn.html#t:HsModule, the LIE entry still has a RdrName which is represented as

(IEVar
      (Qual {ModuleName: L} {OccName: find})))])





On Thu, Jul 4, 2013 at 7:11 PM, Pasqualino "Titto" Assini <tittoassini <at> gmail.com> wrote:
Say that I have a module like:


module Test(L.find) where

import Data.List as L


Using the GHC API, I extract the module exports (using GHC.modInfoExports) and I get a list of names.

Now, I want to get the name of the export with the namespace stated in the source ("L.find")  but I seem to be able to get it only as "Data.List.find".

I have tried different variations of functions on Name or OccName but nothing seems to work.

Obviously, I could just parse the module and get the info that way, but I wondered if it could be done via the API.

Thanks,

    titto

--
Dr. Pasqualino "Titto" Assini
http://quid2.org/


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane