tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

Ormolu uses -- ^ style to annotate arguments of a data constructor #844

Closed mrkkrp closed 1 year ago

mrkkrp commented 2 years ago

Ormolu currently transforms this snippet

-- | Foo.
data Foo
  = Foo
      -- | Bar
      Char
      -- | Baz
      Int

into

-- | Foo.
data Foo
  = Foo
      Char
      -- ^ Bar
      Int
      -- ^ Baz

which seems to be at odds with how we format Haddocks in other contexts. The version with pipes (-- |) is accepted by the latest ghc-lib-parser and so it makes sense to migrate to that style someday.

amesgen commented 2 years ago

Just for the record:

-- | Foo.
data Foo
  = Foo
      -- | Bar
      Char
      -- | Baz
      Int

started to parse (in Haddock mode) with GHC 9.0.1. Hence, we probably only should change the style here when GHC <9.0 is not used that much, as making Haddock suddenly fail is probably a bad experience.

mrkkrp commented 2 years ago

Yeah, I think we should wait a little bit and change when 9.4 is out.