You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Pattern matching on GADTs without MonoLocalBinds is fragile
3
+
summary: Pattern matching on GADTs without MonoLocalBinds is fragile
4
+
introduced: 9.6.1
5
+
severity: warning
6
+
flag: -Wgadt-mono-local-binds
7
+
---
8
+
9
+
This warning is triggered on pattern matching involving GADTs, if `MonoLocalBinds` is disabled. Type inference can be fragile in this case.
10
+
See [the OutsideIn(X) paper](https://doi.org/10.1017/S0956796811000098) and [Let-generalisation](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/let_generalisation.html) for more details.
11
+
To resolve this warning, you can enable `MonoLocalBinds` or an extension implying it (`GADTs` or `TypeFamilies`).
12
+
The warning is also triggered when matching on GADT-like pattern synonyms (i.e. pattern synonyms containing equalities in provided constraints).
13
+
In previous versions of GHC (9.2 and below), it was an error to pattern match on a GADT if neither `GADTs` nor `TypeFamilies` were enabled.
0 commit comments