Brittany fails on explicit kinded data parameters #310

Open
opened 2020-07-12 19:51:14 +02:00 by epicallan · 4 comments
epicallan commented 2020-07-12 19:51:14 +02:00 (Migrated from github.com)

Examples where it's failing:


data Email (a :: k) = Email UserName Domain


data (a :: Symbol) ++: (b :: Type)

Examples where it's failing: ``` data Email (a :: k) = Email UserName Domain data (a :: Symbol) ++: (b :: Type) ```
tfausak commented 2020-07-21 14:05:10 +02:00 (Migrated from github.com)

I was not able to reproduce this error. Which version of Brittany are you using?

# cat issue-310.hs
data Email (a :: k) = Email UserName Domain
data (a :: Symbol) ++: (b :: Type)

# brittany --version
brittany version 0.12.1.1
Copyright (C) 2016-2019 Lennart Spitzner
Copyright (C) 2019 PRODA LTD
There is NO WARRANTY, to the extent permitted by law.

# brittany issue-310.hs 
data Email (a :: k) = Email UserName Domain
data (a :: Symbol) ++: (b :: Type)
I was not able to reproduce this error. Which version of Brittany are you using? ``` sh # cat issue-310.hs data Email (a :: k) = Email UserName Domain data (a :: Symbol) ++: (b :: Type) # brittany --version brittany version 0.12.1.1 Copyright (C) 2016-2019 Lennart Spitzner Copyright (C) 2019 PRODA LTD There is NO WARRANTY, to the extent permitted by law. # brittany issue-310.hs data Email (a :: k) = Email UserName Domain data (a :: Symbol) ++: (b :: Type) ```
epicallan commented 2020-07-23 12:21:20 +02:00 (Migrated from github.com)

Thanks for checking this out.

I was using the latest master at this commit: 55f84c329414814c718a81f590fece76c3f91ad1
I have tried with the latest official version and the bug is not there in the examples I gave you. However, Brittany fails on this code in the latest official version.

data ExampleK (a :: k)

with this error: ERROR: Brittany pretty printer returned syntactically invalid result

Thanks for checking this out. I was using the latest master at this commit: `55f84c329414814c718a81f590fece76c3f91ad1` I have tried with the latest official version and the bug is not there in the examples I gave you. However, Brittany fails on this code in the latest official version. ``` data ExampleK (a :: k) ``` with this error: `ERROR: Brittany pretty printer returned syntactically invalid result`
aschmois commented 2020-08-13 18:08:18 +02:00 (Migrated from github.com)

I think I ran into something similar:

data Foo (bar :: Symbol)

-- This line causes brittany to throw the error
type Baz = Foo "a"

can be worked around by adding -- brittany-disable-next-binding before the type declaration

I think I ran into something similar: ```hs data Foo (bar :: Symbol) -- This line causes brittany to throw the error type Baz = Foo "a" ``` can be worked around by adding `-- brittany-disable-next-binding` before the type declaration
coord-e commented 2020-12-29 10:26:29 +01:00 (Migrated from github.com)

I also ran into an error with a similar code. The log says the following.

ERROR: brittany pretty printer returned syntactically invalid result.
Error: detected unprocessed comments. The transformation output will most likely not contain some of the comments present in the input haskell source file.
Affected are the following comments:
(Comment "(" stdin:1:8 Just AnnOpenP)

This can be reproduced by following the steps below. Although the following uses the released zip file, the same error occurs when installed with cabal-install.

$ docker run -it --rm haskell:8.10 /bin/bash
root@7a496030b9d1:/# cd tmp
root@7a496030b9d1:/tmp# apt update && apt install -y unzip libtinfo5
root@7a496030b9d1:/tmp# curl -fsSL -O https://github.com/lspitzner/brittany/releases/download/0.13.1.0/brittany-0.13.1.0-linux.zip
root@7a496030b9d1:/tmp# unzip brittany-0.13.1.0-linux.zip
root@7a496030b9d1:/tmp# ./brittany <<< "data X (a :: Type)"
ERROR: brittany pretty printer returned syntactically invalid result.
Error: detected unprocessed comments. The transformation output will most likely not contain some of the comments present in the input haskell source file.
Affected are the following comments:
(Comment "(" stdin:1:8 Just AnnOpenP)
I also ran into an error with a similar code. The log says the following. ``` ERROR: brittany pretty printer returned syntactically invalid result. Error: detected unprocessed comments. The transformation output will most likely not contain some of the comments present in the input haskell source file. Affected are the following comments: (Comment "(" stdin:1:8 Just AnnOpenP) ``` This can be reproduced by following the steps below. Although the following uses the released zip file, the same error occurs when installed with cabal-install. <details> ``` $ docker run -it --rm haskell:8.10 /bin/bash root@7a496030b9d1:/# cd tmp root@7a496030b9d1:/tmp# apt update && apt install -y unzip libtinfo5 root@7a496030b9d1:/tmp# curl -fsSL -O https://github.com/lspitzner/brittany/releases/download/0.13.1.0/brittany-0.13.1.0-linux.zip root@7a496030b9d1:/tmp# unzip brittany-0.13.1.0-linux.zip root@7a496030b9d1:/tmp# ./brittany <<< "data X (a :: Type)" ERROR: brittany pretty printer returned syntactically invalid result. Error: detected unprocessed comments. The transformation output will most likely not contain some of the comments present in the input haskell source file. Affected are the following comments: (Comment "(" stdin:1:8 Just AnnOpenP) ``` </details>
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#310
There is no content yet.