lspitzner / brittany

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

Indentation of case-of when not in indentation-sensitive block #232

Open lspitzner opened 5 years ago

lspitzner commented 5 years ago

from the current test-cases:

#test nonempty-case-long
func =
  case
      lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
        lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
    of
      False -> False
      True  -> True

#test nonempty-case-long-do
func = do
  case
      lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
        lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
    of
      False -> False
      True  -> True

For do we obviously need this indentation behaviour, otherwise syntax error. But for contexts where we are allowed to "stay on the current column", this would be nicer:

func =
  case
    lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
      lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
  of
    False -> False
    True  -> True

unfortunately, afaict, this is a problem in the DSL implementation, not in the layouter. Will involve some digging.