wiki:FlexibleContexts

Version 1 (modified by ross@…, 11 years ago) (diff)

Flexible Contexts

See ExtensionDescriptionHowto for information on how to write these extension descriptions. Please add any new extensions to the list of HaskellExtensions.

Brief Explanation

In Haskell 98,

  • contexts of type signarures, newtype and data declarations consist of assertions of the form C v or C (v t1 … tn), where v is a type variable. Contexts on newtype and data declarations are RemovalCandidates.
  • contexts of instance and class declarations consist of assertions of the form C v, where v is a type variable.

The proposal is that class arguments in contexts of type signatures and class declarations may be arbitrary types, e.g.

g :: (C [a], D (a -> b)) => [a] -> b

(Similar relaxation of instance declarations leads to UndecidableInstances.)

References

Pros

  • Pro
  • Pro

Cons

  • Con
  • Con