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

Brittany fails on explicit kinded data parameters #310

Open
epicallan opened this issue Jul 12, 2020 · 4 comments
Open

Brittany fails on explicit kinded data parameters #310

epicallan opened this issue Jul 12, 2020 · 4 comments

Comments

@epicallan
Copy link

Examples where it's failing:


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


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

@tfausak
Copy link
Collaborator

tfausak commented Jul 21, 2020

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)

@epicallan
Copy link
Author

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
Copy link

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

@coord-e
Copy link

coord-e commented Dec 29, 2020

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants