From e7be1041eaeac1e16f58a0e019f81f28ebda8b63 Mon Sep 17 00:00:00 2001 From: Drew Hess Date: Wed, 17 Jul 2024 16:02:34 +0100 Subject: [PATCH] chore: fourmolu 0.16.2.0 Signed-off-by: Drew Hess --- flake.nix | 2 +- primer/src/Primer/Core/Transform.hs | 11 ++++++----- primer/src/Primer/Examples.hs | 3 +-- primer/test/Tests/Action/Available.hs | 9 +++------ primer/test/Tests/Action/Prog.hs | 15 +++++---------- primer/test/Tests/Shadowing.hs | 6 +++--- 6 files changed, 19 insertions(+), 27 deletions(-) diff --git a/flake.nix b/flake.nix index 88b2f2db9..9084d5924 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,7 @@ # Fourmolu updates often alter formatting arbitrarily, and we want to # have more control over this. - fourmoluVersion = "0.15.0.0"; + fourmoluVersion = "0.16.2.0"; allOverlays = [ inputs.haskell-nix.overlay diff --git a/primer/src/Primer/Core/Transform.hs b/primer/src/Primer/Core/Transform.hs index f575b11b0..2d53bf056 100644 --- a/primer/src/Primer/Core/Transform.hs +++ b/primer/src/Primer/Core/Transform.hs @@ -89,12 +89,13 @@ renameVar x y expr = case expr of APP{} -> substAllChildren Con{} -> substAllChildren PrimCon{} -> substAllChildren - -- We assume the term is well-scoped, so do not have any references to the - -- term vars x,y inside any type child (e.g. annotation), so no need to - -- consider renaming inside them. However, but we do need to worry about - -- references to the type var y (term and type variables are in the same - -- namespace) -- we do not want to capture such a y. where + -- We assume the term is well-scoped, so do not have any references to the + -- term vars x,y inside any type child (e.g. annotation), so no need to + -- consider renaming inside them. However, but we do need to worry about + -- references to the type var y (term and type variables are in the same + -- namespace) -- we do not want to capture such a y. + substAllChildren = do guard $ noneOf (typesInExpr % getting _freeVarsTy % _2) (`sameVarRef` y) expr descendM (renameVar x y) expr diff --git a/primer/src/Primer/Examples.hs b/primer/src/Primer/Examples.hs index fb13dd2cd..b967f0917 100644 --- a/primer/src/Primer/Examples.hs +++ b/primer/src/Primer/Examples.hs @@ -267,8 +267,7 @@ comprehensive' typeable modName = do ( hole (con B.cJust [emptyHole] `ann` (tcon B.tMaybe `tapp` tEmptyHole)) ) - ( if typeable then emptyHole else hole $ gvar' (unModuleName modName) "unboundName" - ) + (if typeable then emptyHole else hole $ gvar' (unModuleName modName) "unboundName") ) ( thole (tcon B.tMaybe) diff --git a/primer/test/Tests/Action/Available.hs b/primer/test/Tests/Action/Available.hs index d40876e58..27eb79b57 100644 --- a/primer/test/Tests/Action/Available.hs +++ b/primer/test/Tests/Action/Available.hs @@ -587,8 +587,7 @@ genLoc a = do [ ( 1 , pure - ( typeDefParamNodeSel Nothing - ) + (typeDefParamNodeSel Nothing) ) , ( 3 @@ -599,8 +598,7 @@ genLoc a = do KFun m k1 k2 -> [getID m] <> allKindIDs k1 <> allKindIDs k2 id <- Gen.element @[] $ allKindIDs k pure - ( typeDefParamNodeSel $ Just id - ) + (typeDefParamNodeSel $ Just id) ) ] ) @@ -622,8 +620,7 @@ genLoc a = do (n, t) <- Gen.element $ zip [0 ..] as i <- Gen.element $ t ^.. typeIDs pure - ( typeDefConsNodeSel . Just $ TypeDefConsFieldSelection n i - ) + (typeDefConsNodeSel . Just $ TypeDefConsFieldSelection n i) ) ] ) diff --git a/primer/test/Tests/Action/Prog.hs b/primer/test/Tests/Action/Prog.hs index 17599bb35..baedf7e73 100644 --- a/primer/test/Tests/Action/Prog.hs +++ b/primer/test/Tests/Action/Prog.hs @@ -1313,8 +1313,7 @@ unit_ConFieldAction = unit_ParamKindAction_1 :: Assertion unit_ParamKindAction_1 = progActionTest - ( defaultProgEditableTypeDefs (pure []) - ) + (defaultProgEditableTypeDefs (pure [])) [ParamKindAction tT pB [SetCursor 45, ConstructKFun]] $ expectSuccess $ \_ prog' -> do @@ -1327,8 +1326,7 @@ unit_ParamKindAction_1 = unit_ParamKindAction_2 :: Assertion unit_ParamKindAction_2 = progActionTest - ( defaultProgEditableTypeDefs (pure []) - ) + (defaultProgEditableTypeDefs (pure [])) [ ParamKindAction tT pB [SetCursor 45, ConstructKFun] , ParamKindAction tT pB [SetCursor 51, ConstructKType] ] @@ -1337,8 +1335,7 @@ unit_ParamKindAction_2 = unit_ParamKindAction_2b :: Assertion unit_ParamKindAction_2b = progActionTest - ( defaultProgEditableTypeDefs (pure []) - ) + (defaultProgEditableTypeDefs (pure [])) [ ParamKindAction tT pB [SetCursor 45, ConstructKFun] , ParamKindAction tT pB [SetCursor 51, Delete] ] @@ -1353,8 +1350,7 @@ unit_ParamKindAction_2b = unit_ParamKindAction_3 :: Assertion unit_ParamKindAction_3 = progActionTest - ( defaultProgEditableTypeDefs (pure []) - ) + (defaultProgEditableTypeDefs (pure [])) [ ParamKindAction tT pA [SetCursor 44, Delete] ] $ expectSuccess @@ -1368,8 +1364,7 @@ unit_ParamKindAction_3 = unit_ParamKindAction_bad_id :: Assertion unit_ParamKindAction_bad_id = progActionTest - ( defaultProgEditableTypeDefs (pure []) - ) + (defaultProgEditableTypeDefs (pure [])) [ ParamKindAction tT pB [SetCursor 45, ConstructKFun] , ParamKindAction tT pB [SetCursor 0, ConstructKType] ] diff --git a/primer/test/Tests/Shadowing.hs b/primer/test/Tests/Shadowing.hs index 3fff9fd2d..a334c0115 100644 --- a/primer/test/Tests/Shadowing.hs +++ b/primer/test/Tests/Shadowing.hs @@ -85,7 +85,7 @@ unit_shadow_no_reused_binders = e0 <- ( lam "f" (lvar "f" `app` lvar "f") `ann` ((tEmptyHole `tfun` tEmptyHole) `tfun` tEmptyHole) - ) + ) `app` lam "g" (lam "y" $ lvar "g" `app` lvar "y") e4 <- ( let_ @@ -98,7 +98,7 @@ unit_shadow_no_reused_binders = ) (lam "y" $ lvar "g" `app` lvar "y") `ann` tEmptyHole - ) + ) `ann` tEmptyHole let z = "a88" e5 <- @@ -112,7 +112,7 @@ unit_shadow_no_reused_binders = ) (lam z $ let_ "y" (lvar z) $ lvar "g" `app` lvar "y") `ann` tEmptyHole - ) + ) `ann` tEmptyHole pure (e0, [(0, e0), (4, e4), (5, e5)]) in do