Skip to content

0.9.0.0 regression with multiline comment + record con #1225

Open

Description

@brandonchinn178

Describe the bug

To Reproduce

data FutureSumType
    = {- | This is what the documentation for this type looks like.
      It is pretty awkward that the @--@s aren't aligned.
      -}
      SingleConstructor
      { someRecordField :: Bool
      , someOtherRecordField :: Int
      }

At Ormolu Live, this formats to

data FutureSumType
  = {- | This is what the documentation for this type looks like.
    It is pretty awkward that the @--@s aren't aligned.
    -}
  SingleConstructor
  { someRecordField :: Bool,
    someOtherRecordField :: Int
  }

Expected behavior
Should be a fixed point.

Ormolu 0.8.1.1 formatted this as

data FutureSumType
  = -- | This is what the documentation for this type looks like.
    --      It is pretty awkward that the @--@s aren't aligned.
    SingleConstructor
    { someRecordField :: Bool,
      someOtherRecordField :: Int
    }

Which isn't great, but at least the constructor is at the correct column

Environment

  • OS name + version:
  • Version of the code:

Additional context
Add any other context about the problem here.

Activity

  1. qnikst commented on Oct 4, 2026

    @qnikst
    Member

    Thanks for the comment. Also I noticed that:

    data FutureSumType
      = {- | This is what the documentation for this type looks like.
        It is pretty awkward that the @--@s aren't aligned.
        -}
        SingleConstructor
        { someRecordField :: Bool,
          someOtherRecordField :: Int
        }
        | Foo

    Formats to expected:

    data FutureSumType
      = {- | This is what the documentation for this type looks like.
        It is pretty awkward that the @--@s aren't aligned.
        -}
        SingleConstructor
          { someRecordField :: Bool,
            someOtherRecordField :: Int
          }
      | Foo

    That is expected. And in this case diff is smaller in 0.8, so the same should be for 0.9 as well. Thanks for the report we will take a loot.

  2. qnikst commented on Oct 4, 2026

    @qnikst
    Member

    @brandonchinn178 thanks for report. There is a fix in a linked branch. We will recheck that it does not lead to any problems and publish.

  3. qnikst commented on Oct 5, 2026

    @qnikst
    Member

    Ok, without haddock I have:

    data FutureSumType
        = {- This is what the documentation for this type looks like.
          It is pretty awkward that the @--@s aren't aligned.
          -}
          SingleConstructor
          { someRecordField :: Bool
          , someOtherRecordField :: Int
          }
    
    data FutureSumType
      = {- This is what the documentation for this type looks like.
        It is pretty awkward that the @--@s aren't aligned.
        -}
      SingleConstructor
      { someRecordField :: Bool,
        someOtherRecordField :: Int
      }
    

    And with a constructor

    data FutureSumType
      = {- This is what the documentation for this type looks like.
        It is pretty awkward that the @--@s aren't aligned.
        -}
        SingleConstructor
          { someRecordField :: Bool,
            someOtherRecordField :: Int
          }
      | Foo
    

    And with line comments only:

    data FutureSumType
      = -- This is what the documentation for this type looks like.
      -- It is pretty awkward that the @--@s aren't aligned.
      SingleConstructor
      { someRecordField :: Bool,
        someOtherRecordField :: Int
      }
    

    And

    data FutureSumType
      = SingleConstructor
      { someRecordField :: Bool,
        someOtherRecordField :: Int
      }
    

    With all of that I think it worth restoring at least behaviour of the comments

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions