1
1
mirror of https://github.com/anoma/juvix.git synced 2024-09-19 20:48:55 +03:00

Fix printing of infix constructor values (#2144)

To print e.g.
```agda
(::) :: nil
```
instead of
```agda
:: :: nil
```
This commit is contained in:
Łukasz Czajka 2023-05-30 17:11:18 +02:00 committed by GitHub
parent e9284b3ef6
commit 649d905b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -558,7 +558,7 @@ instance (PrettyCode a) => PrettyCode [a] where
goBinary :: Member (Reader Options) r => Fixity -> Doc Ann -> [Value] -> Sem r (Doc Ann)
goBinary fixity name = \case
[] -> return name
[] -> return (parens name)
[arg] -> do
arg' <- ppRightExpression appFixity arg
return $ parens name <+> arg'
@ -571,7 +571,7 @@ goBinary fixity name = \case
goUnary :: Member (Reader Options) r => Fixity -> Doc Ann -> [Value] -> Sem r (Doc Ann)
goUnary fixity name = \case
[] -> return name
[] -> return (parens name)
[arg] -> do
arg' <- ppPostExpression fixity arg
return $ arg' <+> name

View File

@ -426,3 +426,12 @@ tests:
stdout:
contains: "true"
exit-status: 0
- name: infix-constructors
command:
- juvix
- repl
stdin: "(::) :: nil {Nat -> List Nat -> List Nat}"
stdout:
contains: "(::) :: nil"
exit-status: 0