Comments in list lead to odd formatting for preceding element #231

Open
opened 2019-06-03 05:00:10 +02:00 by expipiplus1 · 4 comments
expipiplus1 commented 2019-06-03 05:00:10 +02:00 (Migrated from github.com)
foo =
  [ ("xx", "xx")
  , ("xx", "xxx")
  , ("xx", "xxx")
  , ( "xx"
    , "xx"
    )
    --
  , ("xx" , "xxxxx")
  , ("xxx", "xxxxx")
  , ("xx" , "xx")
  ]

Note that the formatting of the element before the comment is not consistent with the other elements.

A workaround is butting the comment after the comma:

foo =
  [ ("xx" , "xx")
  , ("xx" , "xxx")
  , ("xx" , "xxx")
  , ("xx" , "xx")
  , -- xxxxxx xxx
    ("xx" , "xxxxx")
  , ("xxx", "xxxxx")
  , ("xx" , "xx")
  ]
```haskell foo = [ ("xx", "xx") , ("xx", "xxx") , ("xx", "xxx") , ( "xx" , "xx" ) -- , ("xx" , "xxxxx") , ("xxx", "xxxxx") , ("xx" , "xx") ] ``` Note that the formatting of the element before the comment is not consistent with the other elements. A workaround is butting the comment after the comma: ```haskell foo = [ ("xx" , "xx") , ("xx" , "xxx") , ("xx" , "xxx") , ("xx" , "xx") , -- xxxxxx xxx ("xx" , "xxxxx") , ("xxx", "xxxxx") , ("xx" , "xx") ] ```
dschrempf commented 2020-02-11 23:27:11 +01:00 (Migrated from github.com)

Actually, similar behavior has led to a semantic error with Haddock for me:

Original code

( DataTypeI       
, DataTypeII(DataConstructor)
  -- * Haddock heading
, name
)

is formatted to

( DataTypeI
, DataTypeII
  ( DataConstructor
    -- * Haddock heading
  )
, name
)

which throws a Haddock error of the form

parse error on input ‘-- * Haddock heading’
source  >    |      
source  > 23 |     -- * Haddock heading
source  >    |     ^^^^^^^^^^^^
Actually, similar behavior has led to a semantic error with Haddock for me: Original code ( DataTypeI , DataTypeII(DataConstructor) -- * Haddock heading , name ) is formatted to ( DataTypeI , DataTypeII ( DataConstructor -- * Haddock heading ) , name ) which throws a Haddock error of the form parse error on input ‘-- * Haddock heading’ source > | source > 23 | -- * Haddock heading source > | ^^^^^^^^^^^^
expipiplus1 commented 2020-02-12 03:39:47 +01:00 (Migrated from github.com)

@dschrempf That's probably worthy of it's own issue

@dschrempf That's probably worthy of it's own issue
dschrempf commented 2020-02-13 18:35:24 +01:00 (Migrated from github.com)

Done, see #281.

Done, see #281.
lspitzner commented 2020-02-13 18:44:31 +01:00 (Migrated from github.com)

I do agree that it is a separate issue, but I cannot help but mention that I ran into (an equivalent of) this while implementing #281. Heh.

I still need to write some tests before I push, but both seem to resolved locally.

I do agree that it is a separate issue, but I cannot help but mention that I ran into (an equivalent of) this while implementing #281. Heh. I still need to write some tests before I push, but both seem to resolved locally.
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#231
There is no content yet.