[GHC] #14423: {-# complete #-} should be able to handle | like {-# minimal #-}

#14423: {-# complete #-} should be able to handle | like {-# minimal #-} -------------------------------------+------------------------------------- Reporter: ekmett | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: 8779 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It'd be really convenient to be able to specify these like we can with `minimal` pragmas, mixing ands and ors. I wind up with a combinatorial explosion of such annotations for the cases where it works when I have large numbers of patterns. I have at least one use case where something that would be a trivial pattern to express with one (complicated) expression involving `|` becomes 64 lines of complete pragmas, and every time I extend it this count doubles. Consider what happens if you add a mix of actual and smart views of a data type: {{{#!hs {-# language ViewPatterns, PatternSynonyms, GeneralizedNewtypeDeriving #-} newtype Delta = Delta Int deriving (Eq,Num) instance Monoid Delta where mempty = 0 mappend = (+) data Exp = Var !Int | AP !Delta !Exp !Exp | LAM !Delta !Exp rel 0 xs = xs rel d (AP d' l r) = AP (d + d') l r rel d (LAM d' b) = LAM (d + d') b rel _ (Var n) = Var n pattern Ap a b <- AP d (rel d -> a) (rel d -> b) where Ap a b = AP 0 a b pattern Lam b <- LAM d (rel d -> b) where Lam b = LAM 0 b {-# complete Var, AP, Lam #-} {-# complete Var, Ap, LAM #-} {-# complete Var, AP, LAM #-} }}} Every data constructor I add with a smart view adds to the powerset of complete pragmas I should supply. On the other hand with `|` patterns: {{{#!hs {-# complete Var, (Ap | AP), (Lam | LAM) #-} }}} extends linearly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14423 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14423: {-# complete #-} should be able to handle | like {-# minimal #-} -------------------------------------+------------------------------------- Reporter: ekmett | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Keywords: Resolution: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 8779 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => PatternSynonyms -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14423#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC