Closed ddssff closed 8 years ago
If there is no export list I would expect everything top level to be global, but...
% ghci > :m +Language.Haskell.Exts.Annotated Language.Haskell.Names Data.Generics Control.Monad > let parsemod s = let ParseOk m = parseModule s in let env = resolve [m] mempty in annotate env m > let gfind = (msum . map return . listify (const True)) > let has ss x = (not . null . filter (`elem` ss)) (gfind x :: [String]) > let test s = mapM_ (putStrLn . show) $ filter (has ["f"]) $ (gfind (parsemod s) :: [NameInfo SrcSpanInfo]) > test "module M (f) where\nf x = x + 1\n" Export [Value {symbolModule = ModuleName "M", symbolName = Ident "f"}] GlobalSymbol (Value {symbolModule = ModuleName "M", symbolName = Ident "f"}) (UnQual (Ident "f")) GlobalSymbol (Value {symbolModule = ModuleName "M", symbolName = Ident "f"}) (UnQual (Ident "f")) > test "module M where\nf x = x + 1\n" >
Found ModuleSymbols.hs
If there is no export list I would expect everything top level to be global, but...