[GHC] #8779: Exhaustiveness checks for pattern synonyms
GHC
ghc-devs at haskell.org
Wed Dec 16 21:45:59 UTC 2015
#8779: Exhaustiveness checks for pattern synonyms
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.8.1
checker) | Keywords:
Resolution: | PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by hvr):
I just stumbled over an annoying case due to our new `ErrorCall` in GHC
8.0:
{{{#!hs
{-# LANGUAGE PatternSynonyms #-}
module Patterns where
-- import Control.Exception (ErrorCall(..))
data ErrorCall = ErrorCallWithLocation String String deriving (Eq, Ord)
pattern ErrorCall :: String -> ErrorCall
pattern ErrorCall err <- ErrorCallWithLocation err _
where ErrorCall err = ErrorCallWithLocation err ""
getMsg :: ErrorCall -> String
getMsg (ErrorCall y) = y
getMsg' :: ErrorCall -> String
getMsg' (ErrorCallWithLocation y _) = y
}}}
With that, GHC HEAD currently warns
{{{
patterns.hs:12:1: warning:
Pattern match(es) are non-exhaustive
In an equation for ‘getMsg’: Patterns not matched: _
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8779#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list