haskell-suite / haskell-names

Haskell suite library for name resolution
52 stars 17 forks source link

Compute getTopDeclSymbols for TypeSig constructor #72

Closed ddssff closed 8 years ago

ddssff commented 8 years ago

Is there a reason no symbols are returned by getTopDeclSymbols for a type signature?

phischu commented 8 years ago

Thank you for your interest. getTopDeclSymbols returns all symbols bound by the given declaration. A type signature does not bind any symbols. The names in top level type signatures reference symbols bound by other top level declarations. For example:

module MyConstant where

five :: Int
five = 5

The second declaration binds Value (ModuleName "MyConstant") (Ident "five"). Better documentation is sorely needed. If you have a specific use case I am glad to help.

ddssff commented 8 years ago

I am using it to make a predicate that selects declarations by symbol name so I could move them to another module. If the definition moves the signature needs to move with it. I just put a wrapper around getTopDeclSymbols to explicitly check the TypeSig case.