git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Provide more information in `exportedDctors`
52c8b68Harry Garrood
psci/Completion.hs+1−1
@@ -218,7 +218,7 @@ dctorNames m = nubOnFst $ concatMap dctors dnames
218 onlyDataDecls = (filter P.isDataDecl (P.exportedDeclarations m))
218 onlyDataDecls = (filter P.isDataDecl (P.exportedDeclarations m))
219
219
220 dctors :: (N.ProperName, P.Declaration) -> [(N.ProperName, P.Declaration)]
220 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))
222
222
223moduleNames :: [P.Module] -> [String]
223moduleNames :: [P.Module] -> [String]
224moduleNames ms = nub [show moduleName | P.Module _ moduleName _ _ <- ms]
224moduleNames 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
78-- |
78-- |
79-- Return the exported data constructors for a given type.
79-- Return the exported data constructors for a given type.
80--
80--
81−exportedDctors :: Module -> ProperName -> [ProperName]
81+exportedDctors :: Module -> ProperName -> [(ProperName, [Type])]
82exportedDctors (Module _ _ decls exps) ident =
82exportedDctors (Module _ _ decls exps) ident =
83− filter (isDctorExported ident exps) dctors
83+ filter (isDctorExported ident exps . fst) dctors
84 where
84 where
85 dctors = concatMap getDctors (flattenDecls decls)
85 dctors = concatMap getDctors (flattenDecls decls)
86− getDctors (DataDeclaration _ _ _ ctors) = map fst ctors
86+ getDctors (DataDeclaration _ _ _ ctors) = ctors
87 getDctors (PositionedDeclaration _ _ d) = getDctors d
87 getDctors (PositionedDeclaration _ _ d) = getDctors d
88 getDctors _ = []
88 getDctors _ = []
89
89