Brittany fails on explicit kinded data parameters
Examples where it's failing:
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?
# 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)
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
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 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)