lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

Newlines between array items are not preserved #260

Open calebmer opened 5 years ago

calebmer commented 5 years ago

I have a program that looks like this:

queryType :: ObjectType Database ()
queryType = query
  Nothing
  [ fieldWithArgs
    "account"
    Nothing
    accountType
    (args1 (arg "id" Nothing intInputType))
    (\context () id ->
      return (databaseTableLookup id (databaseAccounts context))
    )

  , fieldWithArgs
    "post"
    Nothing
    postType
    (args1 (arg "id" Nothing intInputType))
    (\context () id -> return (databaseTableLookup id (databasePosts context)))

  , fieldWithArgs
    "comment"
    Nothing
    commentType
    (args1 (arg "id" Nothing intInputType))
    (\context () id ->
      return (databaseTableLookup id (databaseComments context))
    )
  ]

…but when Brittany runs the newlines are removed and the end result is this:

queryType :: ObjectType Database ()
queryType = query
  Nothing
  [ fieldWithArgs
    "account"
    Nothing
    accountType
    (args1 (arg "id" Nothing intInputType))
    (\context () id ->
      return (databaseTableLookup id (databaseAccounts context))
    )
  , fieldWithArgs
    "post"
    Nothing
    postType
    (args1 (arg "id" Nothing intInputType))
    (\context () id -> return (databaseTableLookup id (databasePosts context)))
  , fieldWithArgs
    "comment"
    Nothing
    commentType
    (args1 (arg "id" Nothing intInputType))
    (\context () id ->
      return (databaseTableLookup id (databaseComments context))
    )
  ]