GHC supports two flags that control the way in which generalisation is carried out at let and where bindings.
Haskell's monomorphism restriction (see
of the Haskell Report)
can be completely switched off by
As an experimental change, we are exploring the possibility of making pattern bindings monomorphic; that is, not generalised at all. A pattern binding is a binding whose LHS has no function arguments, and is not a simple variable. For example:
f x = x -- Not a pattern binding f = \x -> x -- Not a pattern binding f :: Int -> Int = \x -> x -- Not a pattern binding (g,h) = e -- A pattern binding (f) = e -- A pattern binding [x] = e -- A pattern binding
Experimentally, GHC now makes pattern bindings monomorphic by
-XNoMonoPatBinds to recover the