git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #985 from hdgarrood/exported-dctors

Provide more information in `exportedDctors`

commita276b9971daf04fecd6edc61cdbc7b8c99c557fd authorPhil Freeman <paf31@cantab.net> dateThu 19 Mar 2015, 10:28 (12 years ago) parent005eed552c8b68
2 files changed+4−4
psci/Completion.hs+1−1 src/Language/PureScript/AST/Declarations.hs+3−3
psci/Completion.hs+1−1
@@ -218,7 +218,7 @@ dctorNames m = nubOnFst $ concatMap dctors dnames
218218 onlyDataDecls = (filter P.isDataDecl (P.exportedDeclarations m))
219219
220220 dctors :: (N.ProperName, P.Declaration) -> [(N.ProperName, P.Declaration)]
221− dctors (name, decl) = map (\n -> (n, decl)) (P.exportedDctors m name)
221+ dctors (name, decl) = map (\n -> (n, decl)) (map fst (P.exportedDctors m name))
222222
223223moduleNames :: [P.Module] -> [String]
224224moduleNames ms = nub [show moduleName | P.Module _ moduleName _ _ <- ms]
src/Language/PureScript/AST/Declarations.hs+3−3
@@ -78,12 +78,12 @@ isDctorExported ident (Just exps) ctor = test `any` exps
7878-- |
7979-- Return the exported data constructors for a given type.
8080--
81−exportedDctors :: Module -> ProperName -> [ProperName]
81+exportedDctors :: Module -> ProperName -> [(ProperName, [Type])]
8282exportedDctors (Module _ _ decls exps) ident =
83− filter (isDctorExported ident exps) dctors
83+ filter (isDctorExported ident exps . fst) dctors
8484 where
8585 dctors = concatMap getDctors (flattenDecls decls)
86− getDctors (DataDeclaration _ _ _ ctors) = map fst ctors
86+ getDctors (DataDeclaration _ _ _ ctors) = ctors
8787 getDctors (PositionedDeclaration _ _ d) = getDctors d
8888 getDctors _ = []
8989