
#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 Iceland_jack): Replying to [comment:23 dfeuer]:
Yes, sometimes, but when pattern synonyms overlap (e.g., left and right views, with empty), life sucks again.
`MINIMAL` pragmas allow conjunction as well as disjunction {{{#!hs {-# MINIMAL fromRational, (recip | (/)) #-} }}} If you want to express that `Empty` and `(:<|)` form a complete pattern but so does `Empty` and `(:|>)` {{{#!hs pattern Empty :: Seq.Seq a pattern Empty <- (Seq.viewl -> Seq.EmptyL) where Empty = Seq.empty pattern (:<|) :: a -> Seq.Seq a -> Seq.Seq a pattern x :<| xs <- (Seq.viewl -> x Seq.:< xs) where x :<| xs = x Seq.<| xs pattern (:|>) :: Seq.Seq a -> a -> Seq.Seq a pattern xs :|> x <- (Seq.viewr -> xs Seq.:> x) where xs :|> x = xs Seq.|> x }}} so what's stopping us from writing {{{#!hs {-# COMPLETE_PATTERNS (Empty, (:<|)) | (Empty, (:|>)) #-} }}} to mean just that? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8779#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler