git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2135 from garyb/suggest-all-dctors

Use (..) for data constructors in suggestion

commite3e2fba7fe80cd29c374e7db3d994895d880ecff authorGary Burgess <gary.burgess@gmail.com> dateFri 20 May 2016, 17:10 (10 years ago) parent4852b5d4569aa4
1 file changed+9−1
src/Language/PureScript/Linter/Imports.hs+9−1
src/Language/PureScript/Linter/Imports.hs+9−1
@@ -213,7 +213,15 @@ lintImportDecl env mni qualifierName names declType allowImplicit =
213213 checkImplicit warning =
214214 if null allRefs
215215 then unused
216− else warn (warning mni allRefs)
216+ else warn (warning mni (map simplifyTypeRef allRefs))
217+ where
218+ -- Replace explicit type refs with data constructor lists from listing the
219+ -- used constructors explicity `T(X, Y, [...])` to `T(..)` for suggestion
220+ -- message.
221+ simplifyTypeRef :: DeclarationRef -> DeclarationRef
222+ simplifyTypeRef (TypeRef name (Just dctors))
223+ | not (null dctors) = TypeRef name Nothing
224+ simplifyTypeRef other = other
217225
218226 checkExplicit
219227 :: [DeclarationRef]