Skip to content

Commit fb13db9

Browse files
committed
Apply few more automatic refactorings
1 parent 94cc306 commit fb13db9

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

src/Language/PureScript.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
{-# LANGUAGE DataKinds #-}
1717
{-# LANGUAGE FlexibleContexts #-}
18-
{-# LANGUAGE RecordWildCards #-}
1918
{-# LANGUAGE ScopedTypeVariables #-}
2019

2120
module Language.PureScript

src/Language/PureScript/Bundle.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
{-# LANGUAGE FlexibleContexts #-}
2020
{-# LANGUAGE ScopedTypeVariables #-}
2121
{-# LANGUAGE TupleSections #-}
22-
{-# LANGUAGE RecordWildCards #-}
2322

2423
module 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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
--
1313
-----------------------------------------------------------------------------
1414

15-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1615
{-# LANGUAGE FlexibleContexts #-}
1716
{-# LANGUAGE ScopedTypeVariables #-}
1817

src/Language/PureScript/Parser/Lexer.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ instance Show PositionedToken where
158158
show = prettyPrintToken . ptToken
159159

160160
lex :: FilePath -> String -> Either P.ParseError [PositionedToken]
161-
lex filePath input = P.parse parseTokens filePath input
161+
lex = P.parse parseTokens
162162

163163
parseTokens :: P.Parsec String u [PositionedToken]
164164
parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof

src/Language/PureScript/Pretty/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

139139
forall_ :: Pattern () Type ([String], Type)

src/Language/PureScript/Sugar/TypeClasses/Deriving.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
196196
mkFromSpineFunction mn (PositionedDeclaration _ _ d) = mkFromSpineFunction mn d
197197
mkFromSpineFunction _ _ = internalError "mkFromSpineFunction: expected DataDeclaration"
@@ -218,13 +218,13 @@ mkVarMn :: Maybe ModuleName -> String -> Expr
218218
mkVarMn mn s = Var (Qualified mn (Ident s))
219219

220220
mkVar :: String -> Expr
221-
mkVar s = mkVarMn Nothing s
221+
mkVar = mkVarMn Nothing
222222

223223
mkPrelVar :: String -> Expr
224-
mkPrelVar s = mkVarMn (Just (ModuleName [ProperName C.prelude])) s
224+
mkPrelVar = mkVarMn (Just (ModuleName [ProperName C.prelude]))
225225

226226
mkGenVar :: 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

229229
decomposeRec :: Type -> [(String, Type)]
230230
decomposeRec = sortBy (comparing fst) . go

0 commit comments

Comments
 (0)