Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format long lambda clause body on a new line #2015

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Concrete/Pretty/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ instance (SingI s) => PrettyCode (LambdaClause s) where
ppCode LambdaClause {..} = do
lambdaParameters' <- hsep <$> mapM ppPatternAtom _lambdaParameters
lambdaBody' <- ppExpression _lambdaBody
return $ lambdaParameters' <+> kwAssign <+> lambdaBody'
return $ lambdaParameters' <+> kwAssign <> oneLineOrNext lambdaBody'

instance (SingI s) => PrettyCode (CaseBranch s) where
ppCode CaseBranch {..} = do
Expand Down
11 changes: 11 additions & 0 deletions tests/positive/Format.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ positive
type T0 (A : Type) :=
| c0 : (A -> T0 A) -> T0 A;

-- Lambda clause
f : Nat -> Nat;
f :=
\ {
| zero :=
let
foo : Nat := 1;
in foo
| _ := 1
};

module Patterns;
infixr 4 ,;
type Pair :=
Expand Down