git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1747 from purescript/1742-part-2

Remove further remnants of `import M (..)`

commitdeb12b4958decd6b2e9a9e1ada0e9ae84529a04b authorGary Burgess <gary.burgess@gmail.com> dateMon 21 Dec 2015, 01:40 (11 years ago) parentcc91cad3c5c1cb
8 files changed+14−18
psci/Completion.hs+1−1 psci/PSCi.hs+1−1 psci/tests/Main.hs+2−2 src/Language/PureScript/AST/Declarations.hs+4−6 src/Language/PureScript/Errors.hs+1−2 src/Language/PureScript/Linter/Imports.hs+1−2 src/Language/PureScript/Parser/Declarations.hs+1−1 src/Language/PureScript/Sugar/Names/Imports.hs+3−3
psci/Completion.hs+1−1
@@ -171,7 +171,7 @@ getAllQualifications sho m (declName, decl) = do
171171 qualificationsUsing (_, importType, asQ') =
172172 let q = qualifyWith asQ'
173173 in case importType of
174− P.Implicit _ -> [q]
174+ P.Implicit -> [q]
175175 P.Explicit refs -> [q | referencedBy refs]
176176 P.Hiding refs -> [q | not $ referencedBy refs]
177177
psci/PSCi.hs+1−1
@@ -317,7 +317,7 @@ handleShowImportedModules = do
317317 Just mn' -> "qualified " ++ N.runModuleName mn ++ " as " ++ N.runModuleName mn'
318318 Nothing -> N.runModuleName mn ++ " " ++ showDeclType declType
319319
320− showDeclType (P.Implicit _) = ""
320+ showDeclType P.Implicit = ""
321321 showDeclType (P.Explicit refs) = refsList refs
322322 showDeclType (P.Hiding refs) = " hiding " ++ refsList refs
323323 refsList refs = " (" ++ commaList (map showRef refs) ++ ")"
psci/tests/Main.hs+2−2
@@ -141,11 +141,11 @@ getPSCiState = do
141141 Left err ->
142142 print err >> exitFailure
143143 Right modules ->
144− let imports = [controlMonadSTasST, (P.ModuleName [P.ProperName "Prelude"], P.Implicit True, Nothing)]
144+ let imports = [controlMonadSTasST, (P.ModuleName [P.ProperName "Prelude"], P.Implicit, Nothing)]
145145 in return (mkPSCiState imports modules foreigns [] [])
146146
147147controlMonadSTasST :: ImportedModule
148−controlMonadSTasST = (s "Control.Monad.ST", P.Implicit True, Just (s "ST"))
148+controlMonadSTasST = (s "Control.Monad.ST", P.Implicit, Just (s "ST"))
149149 where
150150 s = P.moduleNameFromString
151151
src/Language/PureScript/AST/Declarations.hs+4−6
@@ -47,7 +47,7 @@ getModuleName (Module _ _ name _ _) = name
4747addDefaultImport :: ModuleName -> Module -> Module
4848addDefaultImport toImport m@(Module ss coms mn decls exps) =
4949 if isExistingImport `any` decls || mn == toImport then m
50− else Module ss coms mn (ImportDeclaration toImport (Implicit True) Nothing False : decls) exps
50+ else Module ss coms mn (ImportDeclaration toImport Implicit Nothing False : decls) exps
5151 where
5252 isExistingImport (ImportDeclaration mn' _ _ _) | mn' == toImport = True
5353 isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
@@ -130,11 +130,9 @@ findDuplicateRefs refs =
130130--
131131data ImportDeclarationType
132132 -- |
133− -- An import with no explicit list: `import M`. The boolean signifies whether
134− -- the import was generated by the compiler. If not, a warning is
135− -- raised for each member implicitly imported.
133+ -- An import with no explicit list: `import M`.
136134 --
137− = Implicit Bool
135+ = Implicit
138136 -- |
139137 -- An import with an explicit list of references to import: `import M (foo)`
140138 --
@@ -146,7 +144,7 @@ data ImportDeclarationType
146144 deriving (Eq, Show, Read, D.Data, D.Typeable)
147145
148146isImplicit :: ImportDeclarationType -> Bool
149−isImplicit (Implicit _) = True
147+isImplicit Implicit = True
150148isImplicit _ = False
151149
152150-- |
src/Language/PureScript/Errors.hs+1−2
@@ -1011,8 +1011,7 @@ prettyPrintSingleError full level e = flip evalState defaultUnknownMap $ do
10111011 prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> String
10121012 prettyPrintImport mn idt qual =
10131013 let i = case idt of
1014− Implicit True -> runModuleName mn ++ " (..)"
1015− Implicit False -> runModuleName mn
1014+ Implicit -> runModuleName mn
10161015 Explicit refs -> runModuleName mn ++ " (" ++ intercalate ", " (map prettyPrintRef refs) ++ ")"
10171016 Hiding refs -> runModuleName mn ++ " hiding (" ++ intercalate "," (map prettyPrintRef refs) ++ ")"
10181017 in i ++ maybe "" (\q -> " as " ++ runModuleName q) qual
src/Language/PureScript/Linter/Imports.hs+1−2
@@ -62,8 +62,7 @@ findUnusedImports (Module _ _ _ mdecls mexports) env usedImps = do
6262 usedNames = mapMaybe (matchName (typeForDCtor mni) qualifierName) names
6363 usedDctors = mapMaybe (matchDctor qualifierName) names
6464 in case declType of
65− Implicit _ | null usedNames -> tell $ errorMessage $ UnusedImport mni
66− Implicit False ->
65+ Implicit ->
6766 let classRefs = TypeClassRef <$> mapMaybe getClassName names
6867 valueRefs = ValueRef <$> mapMaybe getIdentName names
6968 types = mapMaybe getTypeName names
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -152,7 +152,7 @@ parseImportDeclaration' = do
152152 return (moduleName', declType, Just qName, True)
153153 qualifyingList expectedType = do
154154 declType <- P.optionMaybe (expectedType <$> (indented *> parens (commaSep parseDeclarationRef)))
155− return $ fromMaybe (Implicit False) declType
155+ return $ fromMaybe Implicit declType
156156
157157parseDeclarationRef :: TokenParser DeclarationRef
158158parseDeclarationRef =
src/Language/PureScript/Sugar/Names/Imports.hs+3−3
@@ -98,7 +98,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
9898
9999 return ()
100100
101− let scope = M.insert currentModule [(Nothing, Implicit True, Nothing)] imports
101+ let scope = M.insert currentModule [(Nothing, Implicit, Nothing)] imports
102102 resolved <- foldM (resolveModuleImport env) nullImports (M.toList scope)
103103 return (Module ss coms currentModule decls' exps, resolved)
104104
@@ -138,7 +138,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
138138 updateImportRef (ImportDeclaration mn typ qual isOldSyntax) = do
139139 modExports <- getExports env mn
140140 typ' <- case typ of
141− Implicit b -> return $ Implicit b
141+ Implicit -> return Implicit
142142 Explicit refs -> Explicit <$> updateProperRef mn modExports `traverse` refs
143143 Hiding refs -> Hiding <$> updateProperRef mn modExports `traverse` refs
144144 return $ ImportDeclaration mn typ' qual isOldSyntax
@@ -191,7 +191,7 @@ resolveImport importModule exps imps impQual = resolveByType
191191 where
192192
193193 resolveByType :: ImportDeclarationType -> m Imports
194− resolveByType (Implicit _) = importAll importExplicit
194+ resolveByType Implicit = importAll importExplicit
195195 resolveByType (Explicit refs) = checkRefs False refs >> foldM importExplicit imps refs
196196 resolveByType (Hiding refs) = do
197197 imps' <- checkRefs True refs >> importAll (importNonHidden refs)