GHC API: modInfoIsExportedName, String -> Name?

Dan Frumib difrumin at gmail.com
Sat Oct 19 16:51:04 UTC 2013


Hi. 
Correct me if I am wrong, but you are not supposed to construct 'Name's yourself. The point is that they are unique and hiding the constructors is a step towards preserving the invariants. 

Here's how I would do something like 'map nameOccName . modInfoExports' and then search for an OccName (which you can construct using mkOccName). 

Unfortunately I don't have GHC handy so I can't test this

Cheers

- Dan

> On 19 Oct 2013, at 17:58, Daniel Trstenjak <daniel.trstenjak at gmail.com> wrote:
> 
> 
> Hi,
> 
> I wanted to use the GHC API to find if a symbol is exported from a module.
> 
> The function 'modInfoIsExportedName :: ModuleInfo -> Name -> Bool' seems to do what
> I want, but how do I convert a symbol string into a 'Name'?
> 
> Thanks for any hints!
> 
> 
> Greetings,
> Daniel
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list