
27 Aug
2010
27 Aug
'10
9:40 a.m.
Hi, is warn-incomplete-patterns (in GHC 6.10.3) less clever than it could be? {-# OPTIONS_GHC -fglasgow-exts #-} {-# OPTIONS_GHC -fwarn-incomplete-patterns #-} module Vec where data Z data S a data Vec n a where VNil :: Vec Z a VCons :: a -> Vec m a -> Vec (S m) a instance Eq a => Eq (Vec n a) where VNil == VNil = True VCons x vx == VCons y vy = x==y && vx == vy give the warning: Warning: Pattern match(es) are non-exhaustive In the definition of `==': Patterns not matched: VNil (VCons _ _) (VCons _ _) VNil but of course VNil and VCons can never have the same type. Tom