git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove further remnants of `import M (..)`
3c5c1cbGary Burgess
psci/Completion.hs+1−1
@@ -171,7 +171,7 @@ getAllQualifications sho m (declName, decl) = do
171 qualificationsUsing (_, importType, asQ') =
171 qualificationsUsing (_, importType, asQ') =
172 let q = qualifyWith asQ'
172 let q = qualifyWith asQ'
173 in case importType of
173 in case importType of
174− P.Implicit _ -> [q]
174+ P.Implicit -> [q]
175 P.Explicit refs -> [q | referencedBy refs]
175 P.Explicit refs -> [q | referencedBy refs]
176 P.Hiding refs -> [q | not $ referencedBy refs]
176 P.Hiding refs -> [q | not $ referencedBy refs]
177
177
psci/PSCi.hs+1−1
@@ -317,7 +317,7 @@ handleShowImportedModules = do
317 Just mn' -> "qualified " ++ N.runModuleName mn ++ " as " ++ N.runModuleName mn'
317 Just mn' -> "qualified " ++ N.runModuleName mn ++ " as " ++ N.runModuleName mn'
318 Nothing -> N.runModuleName mn ++ " " ++ showDeclType declType
318 Nothing -> N.runModuleName mn ++ " " ++ showDeclType declType
319
319
320− showDeclType (P.Implicit _) = ""
320+ showDeclType P.Implicit = ""
321 showDeclType (P.Explicit refs) = refsList refs
321 showDeclType (P.Explicit refs) = refsList refs
322 showDeclType (P.Hiding refs) = " hiding " ++ refsList refs
322 showDeclType (P.Hiding refs) = " hiding " ++ refsList refs
323 refsList refs = " (" ++ commaList (map showRef refs) ++ ")"
323 refsList refs = " (" ++ commaList (map showRef refs) ++ ")"
psci/tests/Main.hs+2−2
@@ -141,11 +141,11 @@ getPSCiState = do
141 Left err ->
141 Left err ->
142 print err >> exitFailure
142 print err >> exitFailure
143 Right modules ->
143 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)]
145 in return (mkPSCiState imports modules foreigns [] [])
145 in return (mkPSCiState imports modules foreigns [] [])
146
146
147controlMonadSTasST :: ImportedModule
147controlMonadSTasST :: ImportedModule
148−controlMonadSTasST = (s "Control.Monad.ST", P.Implicit True, Just (s "ST"))
148+controlMonadSTasST = (s "Control.Monad.ST", P.Implicit, Just (s "ST"))
149 where
149 where
150 s = P.moduleNameFromString
150 s = P.moduleNameFromString
151
151
src/Language/PureScript/AST/Declarations.hs+4−6
@@ -47,7 +47,7 @@ getModuleName (Module _ _ name _ _) = name
47addDefaultImport :: ModuleName -> Module -> Module
47addDefaultImport :: ModuleName -> Module -> Module
48addDefaultImport toImport m@(Module ss coms mn decls exps) =
48addDefaultImport toImport m@(Module ss coms mn decls exps) =
49 if isExistingImport `any` decls || mn == toImport then m
49 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
51 where
51 where
52 isExistingImport (ImportDeclaration mn' _ _ _) | mn' == toImport = True
52 isExistingImport (ImportDeclaration mn' _ _ _) | mn' == toImport = True
53 isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
53 isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
@@ -130,11 +130,9 @@ findDuplicateRefs refs =
130--
130--
131data ImportDeclarationType
131data ImportDeclarationType
132 -- |
132 -- |
133− -- An import with no explicit list: `import M`. The boolean signifies whether
133+ -- An import with no explicit list: `import M`.
134− -- the import was generated by the compiler. If not, a warning is
135− -- raised for each member implicitly imported.
136 --
134 --
137− = Implicit Bool
135+ = Implicit
138 -- |
136 -- |
139 -- An import with an explicit list of references to import: `import M (foo)`
137 -- An import with an explicit list of references to import: `import M (foo)`
140 --
138 --
@@ -146,7 +144,7 @@ data ImportDeclarationType
146 deriving (Eq, Show, Read, D.Data, D.Typeable)
144 deriving (Eq, Show, Read, D.Data, D.Typeable)
147
145
148isImplicit :: ImportDeclarationType -> Bool
146isImplicit :: ImportDeclarationType -> Bool
149−isImplicit (Implicit _) = True
147+isImplicit Implicit = True
150isImplicit _ = False
148isImplicit _ = False
151
149
152-- |
150-- |
src/Language/PureScript/Errors.hs+1−2
@@ -1014,8 +1014,7 @@ prettyPrintSingleError full level e = do
1014 prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> String
1014 prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> String
1015 prettyPrintImport mn idt qual =
1015 prettyPrintImport mn idt qual =
1016 let i = case idt of
1016 let i = case idt of
1017− Implicit True -> runModuleName mn ++ " (..)"
1018− Implicit False -> runModuleName mn
1017+ Implicit -> runModuleName mn
1019 Explicit refs -> runModuleName mn ++ " (" ++ intercalate ", " (map prettyPrintRef refs) ++ ")"
1018 Explicit refs -> runModuleName mn ++ " (" ++ intercalate ", " (map prettyPrintRef refs) ++ ")"
1020 Hiding refs -> runModuleName mn ++ " hiding (" ++ intercalate "," (map prettyPrintRef refs) ++ ")"
1019 Hiding refs -> runModuleName mn ++ " hiding (" ++ intercalate "," (map prettyPrintRef refs) ++ ")"
1021 in i ++ maybe "" (\q -> " as " ++ runModuleName q) qual
1020 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
62 usedNames = mapMaybe (matchName (typeForDCtor mni) qualifierName) names
62 usedNames = mapMaybe (matchName (typeForDCtor mni) qualifierName) names
63 usedDctors = mapMaybe (matchDctor qualifierName) names
63 usedDctors = mapMaybe (matchDctor qualifierName) names
64 in case declType of
64 in case declType of
65− Implicit _ | null usedNames -> tell $ errorMessage $ UnusedImport mni
65+ Implicit ->
66− Implicit False ->
67 let classRefs = TypeClassRef <$> mapMaybe getClassName names
66 let classRefs = TypeClassRef <$> mapMaybe getClassName names
68 valueRefs = ValueRef <$> mapMaybe getIdentName names
67 valueRefs = ValueRef <$> mapMaybe getIdentName names
69 types = mapMaybe getTypeName names
68 types = mapMaybe getTypeName names
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -152,7 +152,7 @@ parseImportDeclaration' = do
152 return (moduleName', declType, Just qName, True)
152 return (moduleName', declType, Just qName, True)
153 qualifyingList expectedType = do
153 qualifyingList expectedType = do
154 declType <- P.optionMaybe (expectedType <$> (indented *> parens (commaSep parseDeclarationRef)))
154 declType <- P.optionMaybe (expectedType <$> (indented *> parens (commaSep parseDeclarationRef)))
155− return $ fromMaybe (Implicit False) declType
155+ return $ fromMaybe Implicit declType
156
156
157parseDeclarationRef :: TokenParser DeclarationRef
157parseDeclarationRef :: TokenParser DeclarationRef
158parseDeclarationRef =
158parseDeclarationRef =
src/Language/PureScript/Sugar/Names/Imports.hs+3−3
@@ -98,7 +98,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
98
98
99 return ()
99 return ()
100
100
101− let scope = M.insert currentModule [(Nothing, Implicit True, Nothing)] imports
101+ let scope = M.insert currentModule [(Nothing, Implicit, Nothing)] imports
102 resolved <- foldM (resolveModuleImport env) nullImports (M.toList scope)
102 resolved <- foldM (resolveModuleImport env) nullImports (M.toList scope)
103 return (Module ss coms currentModule decls' exps, resolved)
103 return (Module ss coms currentModule decls' exps, resolved)
104
104
@@ -138,7 +138,7 @@ resolveImports env (Module ss coms currentModule decls exps) =
138 updateImportRef (ImportDeclaration mn typ qual isOldSyntax) = do
138 updateImportRef (ImportDeclaration mn typ qual isOldSyntax) = do
139 modExports <- getExports env mn
139 modExports <- getExports env mn
140 typ' <- case typ of
140 typ' <- case typ of
141− Implicit b -> return $ Implicit b
141+ Implicit -> return Implicit
142 Explicit refs -> Explicit <$> updateProperRef mn modExports `traverse` refs
142 Explicit refs -> Explicit <$> updateProperRef mn modExports `traverse` refs
143 Hiding refs -> Hiding <$> updateProperRef mn modExports `traverse` refs
143 Hiding refs -> Hiding <$> updateProperRef mn modExports `traverse` refs
144 return $ ImportDeclaration mn typ' qual isOldSyntax
144 return $ ImportDeclaration mn typ' qual isOldSyntax
@@ -191,7 +191,7 @@ resolveImport importModule exps imps impQual = resolveByType
191 where
191 where
192
192
193 resolveByType :: ImportDeclarationType -> m Imports
193 resolveByType :: ImportDeclarationType -> m Imports
194− resolveByType (Implicit _) = importAll importExplicit
194+ resolveByType Implicit = importAll importExplicit
195 resolveByType (Explicit refs) = checkRefs False refs >> foldM importExplicit imps refs
195 resolveByType (Explicit refs) = checkRefs False refs >> foldM importExplicit imps refs
196 resolveByType (Hiding refs) = do
196 resolveByType (Hiding refs) = do
197 imps' <- checkRefs True refs >> importAll (importNonHidden refs)
197 imps' <- checkRefs True refs >> importAll (importNonHidden refs)