Skip to content

Data declarations #4

@superbobry

Description

@superbobry

Following haskell-style-guide data declarations should be indented as follows:

  1. Basic case:

    data Tree a = Branch !a !(Tree a) !(Tree a)
                  | Leaf
  2. Constructors with long names:

    data HttpException
        = InvalidStatusCode Int
        | MissingContentHeader
  3. Records

    data Person = Person
        { firstName :: !String  -- ^ First name
        , lastName  :: !String  -- ^ Last name
        , age       :: !Int     -- ^ Age
        } deriving (Eq, Show)

The current implementations handles the first two cases correctly, the problem is with record indentation:

data Person = Person
              { firstName :: !String  -- ^ First name
              , lastName  :: !String  -- ^ Last name
              , age       :: !Int     -- ^ Age
              } deriving (Eq, Show)      

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