Skip to content

Commit

Permalink
symbols mentioned in type signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
phischu committed Oct 23, 2014
1 parent ae804f4 commit 33936a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Fragnix/ModuleDeclarations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Fragnix.Primitive (

import Language.Haskell.Exts.Annotated (
Module,ModuleName(ModuleName),Decl(..),parseFile,ParseResult(ParseOk,ParseFailed),
SrcSpan,srcInfoSpan,QName(Qual),ann,
SrcSpan,srcInfoSpan,QName(Qual,UnQual),ann,
prettyPrint,Language(Haskell2010),Extension)
import Language.Haskell.Names (
Symbols(Symbols),Error,Scoped(Scoped),computeInterfaces,annotateModule,
Expand Down Expand Up @@ -100,7 +100,10 @@ declaredSymbols modulnameast annotatedast = Symbols (Set.fromList valuesymbols)
(valuesymbols,typesymbols) = partitionEithers (getTopDeclSymbols GlobalTable.empty modulnameast annotatedast)

usedSymbols :: Decl (Scoped SrcSpan) -> [(Maybe ModuleNameS,Symbol)]
usedSymbols = mapMaybe externalSymbol . universeBi
usedSymbols (TypeSig _ names typ) =
mapMaybe externalSymbol (universeBi typ) ++
mapMaybe (externalSymbol . (\n -> UnQual (ann n) n)) names
usedSymbols decl = mapMaybe externalSymbol (universeBi decl)

externalSymbol :: QName (Scoped SrcSpan) -> Maybe (Maybe ModuleNameS,Symbol)
externalSymbol qname = do
Expand Down

0 comments on commit 33936a1

Please sign in to comment.