[Haskell-cafe] A wish for relaxed layout syntax

Benjamin Franksen benjamin.franksen at bessy.de
Wed Mar 28 16:21:08 EDT 2007


Hi,

I often run into the following issue: I want to write a list of lengthy
items like this

mylist = [
  quite_lengthy_list_item_number_one,
  quite_lengthy_list_item_number_two,
  quite_lengthy_list_item_number_three
]

With the current layout rules this is a parse error (at the closing
bracket). Normally I avoid this by indenting everything one level more as
in

mylist = [
    quite_lengthy_list_item_number_one,
    quite_lengthy_list_item_number_two,
    quite_lengthy_list_item_number_three
  ]

but I think this is a little ugly.

Same issue comes up with parenthesized do-blocks, I would like to write

when (condition met) (do
  first thing
  second thing
)

So my wish is for a revised layout rule that allows closing brackets (of all
sorts: ']', ')', '}') to be on the same indent level as the start of the
definition/expression that contains the corresponding opening bracket.

Cheers
Ben



More information about the Haskell-Cafe mailing list