Skip to content

Improve error message for incorrectly indented multi-line patterns

Given

module Repro where

x = case undefined of
  [ y
  , z
  ] -> undefined

GHC complains:

multiline-pattern.hs:5:3: error:
    parse error (possibly incorrect indentation or mismatched brackets)
  |
5 |   , z
  | 

It would be nice if the error message could give some kind of hint that subsequent lines in multi-line patterns have to be indented further than the first line.

This fixes the problem:

module Repro where

x = case undefined of
  [ y
   , z
   ] -> undefined
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information