From e951df077d32242c583650d965e77bc6ddbd2a00 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Wed, 23 Oct 2024 16:02:56 +0200 Subject: [PATCH] Don't put a space after the lambda keyword (#3121) - Closes #3095 --- examples/milestone/Collatz/Collatz.juvix | 2 +- src/Juvix/Compiler/Concrete/Print/Base.hs | 8 ++++---- tests/positive/Format.juvix | 8 ++++---- tests/positive/InstanceImport/M.juvix | 2 +- tests/positive/InstanceImport/Main.juvix | 2 +- tests/positive/SignatureWithBody.juvix | 4 ++-- tests/positive/StdlibList/Data/List.juvix | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/milestone/Collatz/Collatz.juvix b/examples/milestone/Collatz/Collatz.juvix index 8cc560a0ab..cb5054f47b 100644 --- a/examples/milestone/Collatz/Collatz.juvix +++ b/examples/milestone/Collatz/Collatz.juvix @@ -25,4 +25,4 @@ resultHeading : String := "Collatz sequence:"; main : IO := printStringLn welcome - >>> readLn λ {s := printStringLn resultHeading >>> run collatz (stringToNat s)}; + >>> readLn λ{s := printStringLn resultHeading >>> run collatz (stringToNat s)}; diff --git a/src/Juvix/Compiler/Concrete/Print/Base.hs b/src/Juvix/Compiler/Concrete/Print/Base.hs index 4d3b1d5bf1..177ebd2d94 100644 --- a/src/Juvix/Compiler/Concrete/Print/Base.hs +++ b/src/Juvix/Compiler/Concrete/Print/Base.hs @@ -854,10 +854,10 @@ instance (SingI s) => PrettyPrint (Lambda s) where ppCode Lambda {..} = do let lambdaKw' = ppCode _lambdaKw braces' = uncurry enclose (over both ppCode (_lambdaBraces ^. unIrrelevant)) - lambdaClauses' = case _lambdaClauses of - s :| [] -> braces' (ppCode s) - _ -> braces' (blockIndent (vsepHard (ppCode <$> _lambdaClauses))) - lambdaKw' <+> lambdaClauses' + lambdaClauses' = braces' $ case _lambdaClauses of + s :| [] -> ppCode s + _ -> blockIndent (vsepHard (ppCode <$> _lambdaClauses)) + lambdaKw' <> lambdaClauses' instance PrettyPrint Precedence where ppCode = \case diff --git a/tests/positive/Format.juvix b/tests/positive/Format.juvix index dd89b41452..e676a003a5 100644 --- a/tests/positive/Format.juvix +++ b/tests/positive/Format.juvix @@ -167,7 +167,7 @@ exampleFunction2 -> List A -> List A -> Nat := - λ {_ _ _ _ _ _ _ _ _ _ := + λ{_ _ _ _ _ _ _ _ _ _ := undefined -- comment after first + undefined @@ -186,11 +186,11 @@ positive type T0 (A : Type) := c0 : (A -> T0 A) -> T0 A; -- Single Lambda clause -idLambda : {A : Type} -> A -> A := λ {x := x}; +idLambda : {A : Type} -> A -> A := λ{x := x}; -- Lambda clauses f : Nat -> Nat := - \ { + \{ -- comment before lambda pipe | zero := let @@ -305,7 +305,7 @@ module Traits; instance showBoolI : Show Bool := mkShow@{ - show := λ {x := ite x "true" "false"} + show := λ{x := ite x "true" "false"} }; instance diff --git a/tests/positive/InstanceImport/M.juvix b/tests/positive/InstanceImport/M.juvix index 6e78bb0e29..47fe920568 100644 --- a/tests/positive/InstanceImport/M.juvix +++ b/tests/positive/InstanceImport/M.juvix @@ -6,4 +6,4 @@ type T A := mkT@{pp : A → A}; type Unit := unit; instance -unitI : T Unit := mkT λ {x := x}; +unitI : T Unit := mkT λ{x := x}; diff --git a/tests/positive/InstanceImport/Main.juvix b/tests/positive/InstanceImport/Main.juvix index 2a366125b5..fd5fa5a807 100644 --- a/tests/positive/InstanceImport/Main.juvix +++ b/tests/positive/InstanceImport/Main.juvix @@ -8,6 +8,6 @@ type Bool := | false; instance -boolI : T Bool := mkT λ {x := x}; +boolI : T Bool := mkT λ{x := x}; main : Bool := case T.pp unit of unit := T.pp true; diff --git a/tests/positive/SignatureWithBody.juvix b/tests/positive/SignatureWithBody.juvix index c88f949556..b604a5bad4 100644 --- a/tests/positive/SignatureWithBody.juvix +++ b/tests/positive/SignatureWithBody.juvix @@ -3,7 +3,7 @@ module SignatureWithBody; import Stdlib.Prelude open; isNull : {A : Type} → List A → Bool := - λ { + λ{ | nil := true | _ := false }; @@ -11,7 +11,7 @@ isNull : {A : Type} → List A → Bool := isNull' : {A : Type} → List A → Bool := let aux : {A : Type} → List A → Bool := - λ { + λ{ | nil := true | _ := false }; diff --git a/tests/positive/StdlibList/Data/List.juvix b/tests/positive/StdlibList/Data/List.juvix index c5607fb446..5e1fcb2db1 100644 --- a/tests/positive/StdlibList/Data/List.juvix +++ b/tests/positive/StdlibList/Data/List.juvix @@ -27,7 +27,7 @@ filter : (a : Type) → (a → Bool) → List a → List a | a f (:: h hs) := match (f h) - λ { + λ{ | true := :: h (filter a f hs) | false := filter a f hs }; @@ -65,14 +65,14 @@ splitAt : (a : Type) → ℕ → List a → List a × List a | a _ nil := , nil nil | a zero xs := , nil xs | a (suc zero) (:: x xs) := , (:: x nil) xs - | a (suc (suc m)) (:: x xs) := match (splitAt a m xs) λ {(, xs' xs'') := , (:: x xs') xs''}; + | a (suc (suc m)) (:: x xs) := match (splitAt a m xs) λ{(, xs' xs'') := , (:: x xs') xs''}; terminating merge : (a : Type) → (a → a → Ordering) → List a → List a → List a | a cmp (:: x xs) (:: y ys) := match (cmp x y) - λ { + λ{ | LT := :: x (merge a cmp xs (:: y ys)) | _ := :: y (merge a cmp (:: x xs) ys) } @@ -92,7 +92,7 @@ quickSort : (a : Type) → (a → a → Ordering) → List a → List a ltx (y : a) : Bool := match (cmp y x) - λ { + λ{ | LT := true | _ := false };