Commit 122c6776 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari
Browse files

Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms

When programming with the pattern synonyms for `TypeRep`, I noticed that
I was receiving spurious non-exhaustive pattern-match warnings.  This
can be easily fixed by adding `COMPLETE` pragmas for them.

Moreover, there's another pattern synonym in `base`: `ErrorCall`. In
fact, in the original ticket for `COMPLETE` pragmas (#8779), someone
requested that `ErrorCall` be given a `COMPLETE` pragma as well
(https://ghc.haskell.org/trac/ghc/ticket/8779#comment:21).  I decided to
do that as well while I was in town.

Reviewers: bgamari, mpickering, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3231
parent 3e33d334
......@@ -290,6 +290,9 @@ pattern Con con <- TrTyCon _ con _
pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a
pattern Con' con ks <- TrTyCon _ con ks
{-# COMPLETE Fun, App, Con #-}
{-# COMPLETE Fun, App, Con' #-}
----------------- Observation ---------------------
-- | Observe the type constructor of a quantified type representation.
......
......@@ -176,6 +176,8 @@ pattern ErrorCall :: String -> ErrorCall
pattern ErrorCall err <- ErrorCallWithLocation err _ where
ErrorCall err = ErrorCallWithLocation err ""
{-# COMPLETE ErrorCall #-}
-- | @since 4.0.0.0
instance Exception ErrorCall
......
......@@ -69,6 +69,10 @@
replaced by `CostCentresJSON` due to the new JSON export format supported by
the cost centre profiler.
* The `ErrorCall` pattern synonym has been given a `COMPLETE` pragma so that
functions which solely match again `ErrorCall` do not produce
non-exhaustive pattern-match warnings (#8779)
## 4.9.0.0 *May 2016*
* Bundled with GHC 8.0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment