-hasViewPat :: Pat id -> Bool
-hasViewPat p = hasViewPat' (L undefined p)
-
-hasViewPat' :: LPat id -> Bool
-hasViewPat' (L _ p) = go p where
- go (WildPat _) = False
- go (VarPat _) = False
- go (VarPatOut _ _) = False
- go (LazyPat p) = hasViewPat' p
- go (AsPat _ p) = hasViewPat' p
- go (ParPat p) = hasViewPat' p
- go (BangPat p) = hasViewPat' p
- go (ListPat p _) = any hasViewPat' p
- go (TuplePat p _ _) = any hasViewPat' p
- go (PArrPat p _) = any hasViewPat' p
- go (ConPatIn _ p) = go' p
- go (ConPatOut _ _ _ _ p _) = go' p
- go (ViewPat _ _ _) = True
- go (QuasiQuotePat _) = False
- go (LitPat _) = False
- go (NPat _ _ _) = False
- go (NPlusKPat _ _ _ _) = False
- go (TypePat _) = False
- go (SigPatIn p _) = hasViewPat' p
- go (SigPatOut p _) = hasViewPat' p
- go (CoPat _ _ _) = False
- go' p = case p of
- PrefixCon ps -> any hasViewPat' ps
- RecCon (HsRecFields fs _) -> any (hasViewPat' . hsRecFieldArg) fs
- InfixCon p1 p2 -> hasViewPat' p1 || hasViewPat' p2
-
-isWildPat :: Pat id -> Bool
-isWildPat (WildPat _) = True
-isWildPat _ = False
-
-patsAreAllCons :: [Pat id] -> Bool
-patsAreAllCons pat_list = all isConPat pat_list
-
-isConPat :: Pat id -> Bool
-isConPat (AsPat _ pat) = isConPat (unLoc pat)
-isConPat (ConPatIn {}) = True
-isConPat (ConPatOut {}) = True
-isConPat (ListPat {}) = True
-isConPat (PArrPat {}) = True
-isConPat (TuplePat {}) = True
-isConPat _ = False
-
-isSigPat :: Pat id -> Bool
-isSigPat (SigPatIn _ _) = True
-isSigPat (SigPatOut _ _) = True
-isSigPat _ = False
-
-patsAreAllLits :: [Pat id] -> Bool
-patsAreAllLits pat_list = all isLitPat pat_list
-
-isLitPat :: Pat id -> Bool
-isLitPat (AsPat _ pat) = isLitPat (unLoc pat)
-isLitPat (LitPat _) = True
-isLitPat (NPat _ _ _) = True
-isLitPat (NPlusKPat _ _ _ _) = True
-isLitPat _ = False