syntax

Sub-cards (0)Archived
Comments (1)
Reply

git-friendly syntax to minimize diffs and improve git blame.

Bad:

[ firstItem,
  secondItem,
  thirdItem ]

The problem is that diffs are line-based, and in this example adding another item to the list might require changing the lines that involve firstItem or thirdItem.

Good:

list:
  - firstItem
  - secondItem
  - thirdItem

Good:

[
  firstItem,
  secondItem,
  thirdItem,
]
Profile picture

Bad:

data MyType
  = FirstDataCon
  | SecondDataCon
  | ThirdDataCon

Good:

data MyType =
  | FirstDataCon
  | SecondDataCon
  | ThirdDataCon

Good (but tempting to align, so somewhat bad):

data MyType where
  FirstDataCon :: MyType
  SecondDataCon :: MyType
  ThirdDataCon :: MyType