git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Apply few more automatic refactorings
fb13db9Oleg Grenrus
src/Language/PureScript.hs−1
@@ -15,7 +15,6 @@
15
15
16{-# LANGUAGE DataKinds #-}
16{-# LANGUAGE DataKinds #-}
17{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE FlexibleContexts #-}
18−{-# LANGUAGE RecordWildCards #-}
19{-# LANGUAGE ScopedTypeVariables #-}
18{-# LANGUAGE ScopedTypeVariables #-}
20
19
21module Language.PureScript
20module Language.PureScript
src/Language/PureScript/Bundle.hs+1−2
@@ -19,7 +19,6 @@
19{-# LANGUAGE FlexibleContexts #-}
19{-# LANGUAGE FlexibleContexts #-}
20{-# LANGUAGE ScopedTypeVariables #-}
20{-# LANGUAGE ScopedTypeVariables #-}
21{-# LANGUAGE TupleSections #-}
21{-# LANGUAGE TupleSections #-}
22−{-# LANGUAGE RecordWildCards #-}
23
22
24module Language.PureScript.Bundle (
23module Language.PureScript.Bundle (
25 bundle
24 bundle
@@ -531,7 +530,7 @@ codeGen optionsMainModule optionsNamespace ms = renderToString (NN (JSSourceElem
531-- | The bundling function.
530-- | The bundling function.
532-- This function performs dead code elimination, filters empty modules
531-- This function performs dead code elimination, filters empty modules
533-- and generates and prints the final Javascript bundle.
532-- and generates and prints the final Javascript bundle.
534−bundle :: forall m. (Applicative m, MonadError ErrorMessage m)
533+bundle :: (Applicative m, MonadError ErrorMessage m)
535 => [(ModuleIdentifier, String)] -- ^ The input modules. Each module should be javascript rendered from 'Language.PureScript.Make' or @psc@.
534 => [(ModuleIdentifier, String)] -- ^ The input modules. Each module should be javascript rendered from 'Language.PureScript.Make' or @psc@.
536 -> [ModuleIdentifier] -- ^ Entry points. These module identifiers are used as the roots for dead-code elimination
535 -> [ModuleIdentifier] -- ^ Entry points. These module identifiers are used as the roots for dead-code elimination
537 -> Maybe String -- ^ An optional main module.
536 -> Maybe String -- ^ An optional main module.
src/Language/PureScript/Docs/Render.hs+1−3
@@ -49,9 +49,7 @@ renderDeclarationWithOptions opts Declaration{..} =
49 [ keywordClass ]
49 [ keywordClass ]
50 ++ maybeToList superclasses
50 ++ maybeToList superclasses
51 ++ [renderType' (typeApp declTitle args)]
51 ++ [renderType' (typeApp declTitle args)]
52− ++ if any (isTypeClassMember . cdeclInfo) declChildren
52+ ++ [keywordWhere | any (isTypeClassMember . cdeclInfo) declChildren]
53− then [keywordWhere]
54− else []
55
53
56 where
54 where
57 superclasses
55 superclasses
src/Language/PureScript/Linter.hs−1
@@ -12,7 +12,6 @@
12--
12--
13-----------------------------------------------------------------------------
13-----------------------------------------------------------------------------
14
14
15−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
16{-# LANGUAGE FlexibleContexts #-}
15{-# LANGUAGE FlexibleContexts #-}
17{-# LANGUAGE ScopedTypeVariables #-}
16{-# LANGUAGE ScopedTypeVariables #-}
18
17
src/Language/PureScript/Parser/Lexer.hs+1−1
@@ -158,7 +158,7 @@ instance Show PositionedToken where
158 show = prettyPrintToken . ptToken
158 show = prettyPrintToken . ptToken
159
159
160lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
160lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
161−lex filePath input = P.parse parseTokens filePath input
161+lex = P.parse parseTokens
162
162
163parseTokens :: P.Parsec String u [PositionedToken]
163parseTokens :: P.Parsec String u [PositionedToken]
164parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof
164parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof
src/Language/PureScript/Pretty/Types.hs+1−1
@@ -133,7 +133,7 @@ matchType = buildPrettyPrinter operators matchTypeAtom
133 ]
133 ]
134 , [ Wrap constrained $ \deps ty -> constraintsAsBox deps ty ]
134 , [ Wrap constrained $ \deps ty -> constraintsAsBox deps ty ]
135 , [ Wrap forall_ $ \idents ty -> text ("forall " ++ unwords idents ++ ". ") <> ty ]
135 , [ Wrap forall_ $ \idents ty -> text ("forall " ++ unwords idents ++ ". ") <> ty ]
136− , [ Wrap kinded $ \k ty -> ty `before` (text (" :: " ++ prettyPrintKind k)) ]
136+ , [ Wrap kinded $ \k ty -> ty `before` text (" :: " ++ prettyPrintKind k) ]
137 ]
137 ]
138
138
139forall_ :: Pattern () Type ([String], Type)
139forall_ :: Pattern () Type ([String], Type)
src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+5−5
@@ -168,7 +168,7 @@ mkFromSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> (addCatch
168 return $ CaseAlternative [ prodBinder [ StringBinder (runProperName ctorName), ArrayBinder (map VarBinder idents)]]
168 return $ CaseAlternative [ prodBinder [ StringBinder (runProperName ctorName), ArrayBinder (map VarBinder idents)]]
169 . Right
169 . Right
170 $ liftApplicative (mkJust $ Constructor (Qualified (Just mn) ctorName))
170 $ liftApplicative (mkJust $ Constructor (Qualified (Just mn) ctorName))
171− (zipWith fromSpineFun (map (Var . (Qualified Nothing)) idents) tys)
171+ (zipWith fromSpineFun (map (Var . Qualified Nothing) idents) tys)
172
172
173 addCatch :: [CaseAlternative] -> [CaseAlternative]
173 addCatch :: [CaseAlternative] -> [CaseAlternative]
174 addCatch = (++ [catchAll])
174 addCatch = (++ [catchAll])
@@ -191,7 +191,7 @@ mkFromSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> (addCatch
191 $ liftApplicative (mkRecFun rs) (map (\(x, y) -> fromSpineFun (Accessor "recValue" (mkVar x)) y) rs)
191 $ liftApplicative (mkRecFun rs) (map (\(x, y) -> fromSpineFun (Accessor "recValue" (mkVar x)) y) rs)
192
192
193 mkRecFun :: [(String, Type)] -> Expr
193 mkRecFun :: [(String, Type)] -> Expr
194− mkRecFun xs = mkJust $ foldr (\s e -> lam s e) recLiteral (map fst xs)
194+ mkRecFun xs = mkJust $ foldr lam recLiteral (map fst xs)
195 where recLiteral = ObjectLiteral $ map (\(s,_) -> (s,mkVar s)) xs
195 where recLiteral = ObjectLiteral $ map (\(s,_) -> (s,mkVar s)) xs
196mkFromSpineFunction mn (PositionedDeclaration _ _ d) = mkFromSpineFunction mn d
196mkFromSpineFunction mn (PositionedDeclaration _ _ d) = mkFromSpineFunction mn d
197mkFromSpineFunction _ _ = internalError "mkFromSpineFunction: expected DataDeclaration"
197mkFromSpineFunction _ _ = internalError "mkFromSpineFunction: expected DataDeclaration"
@@ -218,13 +218,13 @@ mkVarMn :: Maybe ModuleName -> String -> Expr
218mkVarMn mn s = Var (Qualified mn (Ident s))
218mkVarMn mn s = Var (Qualified mn (Ident s))
219
219
220mkVar :: String -> Expr
220mkVar :: String -> Expr
221−mkVar s = mkVarMn Nothing s
221+mkVar = mkVarMn Nothing
222
222
223mkPrelVar :: String -> Expr
223mkPrelVar :: String -> Expr
224−mkPrelVar s = mkVarMn (Just (ModuleName [ProperName C.prelude])) s
224+mkPrelVar = mkVarMn (Just (ModuleName [ProperName C.prelude]))
225
225
226mkGenVar :: String -> Expr
226mkGenVar :: String -> Expr
227−mkGenVar s = mkVarMn (Just (ModuleName [ProperName "Data", ProperName C.generic])) s
227+mkGenVar = mkVarMn (Just (ModuleName [ProperName "Data", ProperName C.generic]))
228
228
229decomposeRec :: Type -> [(String, Type)]
229decomposeRec :: Type -> [(String, Type)]
230decomposeRec = sortBy (comparing fst) . go
230decomposeRec = sortBy (comparing fst) . go