Brittany fails to format code with Haddock comments in module export list #365

Open
opened 2022-01-17 12:45:10 +01:00 by vaclavsvejcar · 2 comments
vaclavsvejcar commented 2022-01-17 12:45:10 +01:00 (Migrated from github.com)

Most recent version of Brittany from master (0aa04af) fails when Haddock comments are present in list of exported declarations. Here is the example to replicate:

module Example
  ( -- * Brittany doesn't like this comment
    foo
  ) where

foo :: String
foo = "hello"

Output:

Error: Command failed: /Users/vaclav/.local/bin/brittany Example.hs --write-mode display
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 "-- * Brittany doesn't like this comment" Example.hs:2:5-43 Nothing)
(Comment "-- * Brittany doesn't like this comment" Example.hs:2:5-43 Nothing)

Until now I was using quite old version (built from 434854f) and that works fine.

Most recent version of _Brittany_ from `master` (`0aa04af`) fails when _Haddock_ comments are present in list of exported declarations. Here is the example to replicate: ```haskell module Example ( -- * Brittany doesn't like this comment foo ) where foo :: String foo = "hello" ``` Output: ``` Error: Command failed: /Users/vaclav/.local/bin/brittany Example.hs --write-mode display 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 "-- * Brittany doesn't like this comment" Example.hs:2:5-43 Nothing) (Comment "-- * Brittany doesn't like this comment" Example.hs:2:5-43 Nothing) ``` Until now I was using quite old version (built from `434854f`) and that works fine.
vaclavsvejcar commented 2022-02-22 08:24:54 +01:00 (Migrated from github.com)

@tfausak Do you have any idea if there's any workaround for this? Usually it makes brittany unusable for any code containing comments in export list. Or if you could point me (at least approximately) into part of brittany codebase that could be responsible for this, I could try to find the issue (comparing with older version where it worked, etc). I'm happy to help, it's just super difficult for me to get into brittany codebase, mainly due to ghc-exactprint, for which I cannot find any reasonable introduction or documentation.

@tfausak Do you have any idea if there's any workaround for this? Usually it makes brittany unusable for any code containing comments in export list. Or if you could point me (at least approximately) into part of brittany codebase that could be responsible for this, I could try to find the issue (comparing with older version where it worked, etc). I'm happy to help, it's just super difficult for me to get into brittany codebase, mainly due to ghc-exactprint, for which I cannot find any reasonable introduction or documentation.
tfausak commented 2022-02-28 14:01:09 +01:00 (Migrated from github.com)

Sorry, I do not have a workaround for this.

I don't know where exactly to look for this behavior. It certainly changed as part of #357, but lots of things changed there.

Sorry, I do not have a workaround for this. I don't know where exactly to look for this behavior. It certainly changed as part of #357, but lots of things changed there.
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#365
There is no content yet.