git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Apply few more automatic refactorings
commitfb13db912a1a661fe2da98ae5e91762a80677111 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSat 7 Nov 2015, 19:52 (11 years ago) parent94cc306
7 files changed+9−14
src/Language/PureScript.hs−1 src/Language/PureScript/Bundle.hs+1−2 src/Language/PureScript/Docs/Render.hs+1−3 src/Language/PureScript/Linter.hs−1 src/Language/PureScript/Parser/Lexer.hs+1−1 src/Language/PureScript/Pretty/Types.hs+1−1 src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+5−5
src/Language/PureScript.hs−1
@@ -15,7 +15,6 @@
1515
1616{-# LANGUAGE DataKinds #-}
1717{-# LANGUAGE FlexibleContexts #-}
18−{-# LANGUAGE RecordWildCards #-}
1918{-# LANGUAGE ScopedTypeVariables #-}
2019
2120module Language.PureScript
src/Language/PureScript/Bundle.hs+1−2
@@ -19,7 +19,6 @@
1919{-# LANGUAGE FlexibleContexts #-}
2020{-# LANGUAGE ScopedTypeVariables #-}
2121{-# LANGUAGE TupleSections #-}
22−{-# LANGUAGE RecordWildCards #-}
2322
2423module Language.PureScript.Bundle (
2524 bundle
@@ -531,7 +530,7 @@ codeGen optionsMainModule optionsNamespace ms = renderToString (NN (JSSourceElem
531530-- | The bundling function.
532531-- This function performs dead code elimination, filters empty modules
533532-- and generates and prints the final Javascript bundle.
534−bundle :: forall m. (Applicative m, MonadError ErrorMessage m)
533+bundle :: (Applicative m, MonadError ErrorMessage m)
535534 => [(ModuleIdentifier, String)] -- ^ The input modules. Each module should be javascript rendered from 'Language.PureScript.Make' or @psc@.
536535 -> [ModuleIdentifier] -- ^ Entry points. These module identifiers are used as the roots for dead-code elimination
537536 -> Maybe String -- ^ An optional main module.
src/Language/PureScript/Docs/Render.hs+1−3
@@ -49,9 +49,7 @@ renderDeclarationWithOptions opts Declaration{..} =
4949 [ keywordClass ]
5050 ++ maybeToList superclasses
5151 ++ [renderType' (typeApp declTitle args)]
52− ++ if any (isTypeClassMember . cdeclInfo) declChildren
53− then [keywordWhere]
54− else []
52+ ++ [keywordWhere | any (isTypeClassMember . cdeclInfo) declChildren]
5553
5654 where
5755 superclasses
src/Language/PureScript/Linter.hs−1
@@ -12,7 +12,6 @@
1212--
1313-----------------------------------------------------------------------------
1414
15−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1615{-# LANGUAGE FlexibleContexts #-}
1716{-# LANGUAGE ScopedTypeVariables #-}
1817
src/Language/PureScript/Parser/Lexer.hs+1−1
@@ -158,7 +158,7 @@ instance Show PositionedToken where
158158 show = prettyPrintToken . ptToken
159159
160160lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
161−lex filePath input = P.parse parseTokens filePath input
161+lex = P.parse parseTokens
162162
163163parseTokens :: P.Parsec String u [PositionedToken]
164164parseTokens = 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
133133 ]
134134 , [ Wrap constrained $ \deps ty -> constraintsAsBox deps ty ]
135135 , [ 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) ]
137137 ]
138138
139139forall_ :: Pattern () Type ([String], Type)
src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+5−5
@@ -168,7 +168,7 @@ mkFromSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> (addCatch
168168 return $ CaseAlternative [ prodBinder [ StringBinder (runProperName ctorName), ArrayBinder (map VarBinder idents)]]
169169 . Right
170170 $ 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)
172172
173173 addCatch :: [CaseAlternative] -> [CaseAlternative]
174174 addCatch = (++ [catchAll])
@@ -191,7 +191,7 @@ mkFromSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> (addCatch
191191 $ liftApplicative (mkRecFun rs) (map (\(x, y) -> fromSpineFun (Accessor "recValue" (mkVar x)) y) rs)
192192
193193 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)
195195 where recLiteral = ObjectLiteral $ map (\(s,_) -> (s,mkVar s)) xs
196196mkFromSpineFunction mn (PositionedDeclaration _ _ d) = mkFromSpineFunction mn d
197197mkFromSpineFunction _ _ = internalError "mkFromSpineFunction: expected DataDeclaration"
@@ -218,13 +218,13 @@ mkVarMn :: Maybe ModuleName -> String -> Expr
218218mkVarMn mn s = Var (Qualified mn (Ident s))
219219
220220mkVar :: String -> Expr
221−mkVar s = mkVarMn Nothing s
221+mkVar = mkVarMn Nothing
222222
223223mkPrelVar :: String -> Expr
224−mkPrelVar s = mkVarMn (Just (ModuleName [ProperName C.prelude])) s
224+mkPrelVar = mkVarMn (Just (ModuleName [ProperName C.prelude]))
225225
226226mkGenVar :: String -> Expr
227−mkGenVar s = mkVarMn (Just (ModuleName [ProperName "Data", ProperName C.generic])) s
227+mkGenVar = mkVarMn (Just (ModuleName [ProperName "Data", ProperName C.generic]))
228228
229229decomposeRec :: Type -> [(String, Type)]
230230decomposeRec = sortBy (comparing fst) . go