{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE FlexibleInstances #-}
module HsPat (
Pat(..), InPat, OutPat, LPat,
ListPatTc(..),
HsConPatDetails, hsConPatArgs,
HsRecFields(..), HsRecField'(..), LHsRecField',
HsRecField, LHsRecField,
HsRecUpdField, LHsRecUpdField,
hsRecFields, hsRecFieldSel, hsRecFieldId, hsRecFieldsArgs,
hsRecUpdFieldId, hsRecUpdFieldOcc, hsRecUpdFieldRdr,
mkPrefixConPat, mkCharLitPat, mkNilPat,
looksLazyPatBind,
isBangedLPat,
patNeedsParens, parenthesizePat,
isIrrefutableHsPat,
collectEvVarsPat, collectEvVarsPats,
pprParendLPat, pprConArgs
) where
import GhcPrelude
import {-# SOURCE #-} HsExpr (SyntaxExpr, LHsExpr, HsSplice, pprLExpr, pprSplice)
import HsBinds
import HsLit
import HsExtension
import HsTypes
import TcEvidence
import BasicTypes
import PprCore ( )
import TysWiredIn
import Var
import RdrName ( RdrName )
import ConLike
import DataCon
import TyCon
import Outputable
import Type
import SrcLoc
import Bag
import DynFlags( gopt, GeneralFlag(..) )
import Maybes
import Data.Data hiding (TyCon,Fixity)
type InPat p = LPat p
type OutPat p = LPat p
type LPat p = Pat p
data Pat p
=
WildPat (XWildPat p)
| VarPat (XVarPat p)
(Located (IdP p))
| LazyPat (XLazyPat p)
(LPat p)
| AsPat (XAsPat p)
(Located (IdP p)) (LPat p)
| ParPat (XParPat p)
(LPat p)
| BangPat (XBangPat p)
(LPat p)
| ListPat (XListPat p)
[LPat p]
| TuplePat (XTuplePat p)
[LPat p]
Boxity
| SumPat (XSumPat p)
(LPat p)
ConTag
Arity
| ConPatIn (Located (IdP p))
(HsConPatDetails p)
| ConPatOut {
Pat p -> Located ConLike
pat_con :: Located ConLike,
Pat p -> [Type]
pat_arg_tys :: [Type],
Pat p -> [TyVar]
pat_tvs :: [TyVar],
Pat p -> [TyVar]
pat_dicts :: [EvVar],
Pat p -> TcEvBinds
pat_binds :: TcEvBinds,
Pat p -> HsConPatDetails p
pat_args :: HsConPatDetails p,
Pat p -> HsWrapper
pat_wrap :: HsWrapper
}
| ViewPat (XViewPat p)
(LHsExpr p)
(LPat p)
| SplicePat (XSplicePat p)
(HsSplice p)
| LitPat (XLitPat p)
(HsLit p)
| NPat
(XNPat p)
(Located (HsOverLit p))
(Maybe (SyntaxExpr p))
(SyntaxExpr p)
| NPlusKPat (XNPlusKPat p)
(Located (IdP p))
(Located (HsOverLit p))
(HsOverLit p)
(SyntaxExpr p)
(SyntaxExpr p)
| SigPat (XSigPat p)
(LPat p)
(LHsSigWcType (NoGhcTc p))
| CoPat (XCoPat p)
HsWrapper
(Pat p)
Type
| XPat
(XXPat p)
data ListPatTc
= ListPatTc
Type
(Maybe (Type, SyntaxExpr GhcTc))
type instance XWildPat GhcPs = NoExt
type instance XWildPat GhcRn = NoExt
type instance XWildPat GhcTc = Type
type instance XVarPat (GhcPass _) = NoExt
type instance XLazyPat (GhcPass _) = NoExt
type instance XAsPat (GhcPass _) = NoExt
type instance XParPat (GhcPass _) = NoExt
type instance XBangPat (GhcPass _) = NoExt
type instance XListPat GhcPs = NoExt
type instance XListPat GhcRn = Maybe (SyntaxExpr GhcRn)
type instance XListPat GhcTc = ListPatTc
type instance XTuplePat GhcPs = NoExt
type instance XTuplePat GhcRn = NoExt
type instance XTuplePat GhcTc = [Type]
type instance XSumPat GhcPs = NoExt
type instance XSumPat GhcRn = NoExt
type instance XSumPat GhcTc = [Type]
type instance XViewPat GhcPs = NoExt
type instance XViewPat GhcRn = NoExt
type instance XViewPat GhcTc = Type
type instance XSplicePat (GhcPass _) = NoExt
type instance XLitPat (GhcPass _) = NoExt
type instance XNPat GhcPs = NoExt
type instance XNPat GhcRn = NoExt
type instance XNPat GhcTc = Type
type instance XNPlusKPat GhcPs = NoExt
type instance XNPlusKPat GhcRn = NoExt
type instance XNPlusKPat GhcTc = Type
type instance XSigPat GhcPs = NoExt
type instance XSigPat GhcRn = NoExt
type instance XSigPat GhcTc = Type
type instance XCoPat (GhcPass _) = NoExt
type instance XXPat (GhcPass p) = Located (Pat (GhcPass p))
type instance SrcSpanLess (LPat (GhcPass p)) = Pat (GhcPass p)
instance HasSrcSpan (LPat (GhcPass p)) where
composeSrcSpan :: Located (SrcSpanLess (LPat (GhcPass p))) -> LPat (GhcPass p)
composeSrcSpan (L SrcSpan
sp SrcSpanLess (LPat (GhcPass p))
p) = if SrcSpan
sp SrcSpan -> SrcSpan -> Bool
forall a. Eq a => a -> a -> Bool
== SrcSpan
noSrcSpan
then SrcSpanLess (LPat (GhcPass p))
LPat (GhcPass p)
p
else XXPat (GhcPass p) -> LPat (GhcPass p)
forall p. XXPat p -> Pat p
XPat (SrcSpan
-> LPat (GhcPass p) -> GenLocated SrcSpan (LPat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpan
sp (LPat (GhcPass p) -> LPat (GhcPass p)
forall (p :: Pass). LPat (GhcPass p) -> LPat (GhcPass p)
stripSrcSpanPat SrcSpanLess (LPat (GhcPass p))
LPat (GhcPass p)
p))
decomposeSrcSpan :: LPat (GhcPass p) -> Located (SrcSpanLess (LPat (GhcPass p)))
decomposeSrcSpan (XPat (L sp p)) = SrcSpan
-> LPat (GhcPass p) -> GenLocated SrcSpan (LPat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpan
sp (LPat (GhcPass p) -> LPat (GhcPass p)
forall (p :: Pass). LPat (GhcPass p) -> LPat (GhcPass p)
stripSrcSpanPat LPat (GhcPass p)
p)
decomposeSrcSpan LPat (GhcPass p)
p = SrcSpan
-> LPat (GhcPass p) -> GenLocated SrcSpan (LPat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpan
noSrcSpan LPat (GhcPass p)
p
stripSrcSpanPat :: LPat (GhcPass p) -> Pat (GhcPass p)
stripSrcSpanPat :: LPat (GhcPass p) -> LPat (GhcPass p)
stripSrcSpanPat (XPat (L _ p)) = LPat (GhcPass p) -> LPat (GhcPass p)
forall (p :: Pass). LPat (GhcPass p) -> LPat (GhcPass p)
stripSrcSpanPat LPat (GhcPass p)
p
stripSrcSpanPat LPat (GhcPass p)
p = LPat (GhcPass p)
p
type HsConPatDetails p = HsConDetails (LPat p) (HsRecFields p (LPat p))
hsConPatArgs :: HsConPatDetails p -> [LPat p]
hsConPatArgs :: HsConPatDetails p -> [LPat p]
hsConPatArgs (PrefixCon [LPat p]
ps) = [LPat p]
ps
hsConPatArgs (RecCon HsRecFields p (LPat p)
fs) = (LHsRecField p (LPat p) -> LPat p)
-> [LHsRecField p (LPat p)] -> [LPat p]
forall a b. (a -> b) -> [a] -> [b]
map (HsRecField' (FieldOcc p) (LPat p) -> LPat p
forall id arg. HsRecField' id arg -> arg
hsRecFieldArg (HsRecField' (FieldOcc p) (LPat p) -> LPat p)
-> (LHsRecField p (LPat p) -> HsRecField' (FieldOcc p) (LPat p))
-> LHsRecField p (LPat p)
-> LPat p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsRecField p (LPat p) -> HsRecField' (FieldOcc p) (LPat p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc) (HsRecFields p (LPat p) -> [LHsRecField p (LPat p)]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p (LPat p)
fs)
hsConPatArgs (InfixCon LPat p
p1 LPat p
p2) = [LPat p
p1,LPat p
p2]
data HsRecFields p arg
= HsRecFields { HsRecFields p arg -> [LHsRecField p arg]
rec_flds :: [LHsRecField p arg],
HsRecFields p arg -> Maybe Int
rec_dotdot :: Maybe Int }
deriving (a -> HsRecFields p b -> HsRecFields p a
(a -> b) -> HsRecFields p a -> HsRecFields p b
(forall a b. (a -> b) -> HsRecFields p a -> HsRecFields p b)
-> (forall a b. a -> HsRecFields p b -> HsRecFields p a)
-> Functor (HsRecFields p)
forall a b. a -> HsRecFields p b -> HsRecFields p a
forall a b. (a -> b) -> HsRecFields p a -> HsRecFields p b
forall p a b. a -> HsRecFields p b -> HsRecFields p a
forall p a b. (a -> b) -> HsRecFields p a -> HsRecFields p b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> HsRecFields p b -> HsRecFields p a
$c<$ :: forall p a b. a -> HsRecFields p b -> HsRecFields p a
fmap :: (a -> b) -> HsRecFields p a -> HsRecFields p b
$cfmap :: forall p a b. (a -> b) -> HsRecFields p a -> HsRecFields p b
Functor, HsRecFields p a -> Bool
(a -> m) -> HsRecFields p a -> m
(a -> b -> b) -> b -> HsRecFields p a -> b
(forall m. Monoid m => HsRecFields p m -> m)
-> (forall m a. Monoid m => (a -> m) -> HsRecFields p a -> m)
-> (forall m a. Monoid m => (a -> m) -> HsRecFields p a -> m)
-> (forall a b. (a -> b -> b) -> b -> HsRecFields p a -> b)
-> (forall a b. (a -> b -> b) -> b -> HsRecFields p a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsRecFields p a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsRecFields p a -> b)
-> (forall a. (a -> a -> a) -> HsRecFields p a -> a)
-> (forall a. (a -> a -> a) -> HsRecFields p a -> a)
-> (forall a. HsRecFields p a -> [a])
-> (forall a. HsRecFields p a -> Bool)
-> (forall a. HsRecFields p a -> Int)
-> (forall a. Eq a => a -> HsRecFields p a -> Bool)
-> (forall a. Ord a => HsRecFields p a -> a)
-> (forall a. Ord a => HsRecFields p a -> a)
-> (forall a. Num a => HsRecFields p a -> a)
-> (forall a. Num a => HsRecFields p a -> a)
-> Foldable (HsRecFields p)
forall a. Eq a => a -> HsRecFields p a -> Bool
forall a. Num a => HsRecFields p a -> a
forall a. Ord a => HsRecFields p a -> a
forall m. Monoid m => HsRecFields p m -> m
forall a. HsRecFields p a -> Bool
forall a. HsRecFields p a -> Int
forall a. HsRecFields p a -> [a]
forall a. (a -> a -> a) -> HsRecFields p a -> a
forall p a. Eq a => a -> HsRecFields p a -> Bool
forall p a. Num a => HsRecFields p a -> a
forall p a. Ord a => HsRecFields p a -> a
forall m a. Monoid m => (a -> m) -> HsRecFields p a -> m
forall p m. Monoid m => HsRecFields p m -> m
forall p a. HsRecFields p a -> Bool
forall p a. HsRecFields p a -> Int
forall p a. HsRecFields p a -> [a]
forall b a. (b -> a -> b) -> b -> HsRecFields p a -> b
forall a b. (a -> b -> b) -> b -> HsRecFields p a -> b
forall p a. (a -> a -> a) -> HsRecFields p a -> a
forall p m a. Monoid m => (a -> m) -> HsRecFields p a -> m
forall p b a. (b -> a -> b) -> b -> HsRecFields p a -> b
forall p a b. (a -> b -> b) -> b -> HsRecFields p a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: HsRecFields p a -> a
$cproduct :: forall p a. Num a => HsRecFields p a -> a
sum :: HsRecFields p a -> a
$csum :: forall p a. Num a => HsRecFields p a -> a
minimum :: HsRecFields p a -> a
$cminimum :: forall p a. Ord a => HsRecFields p a -> a
maximum :: HsRecFields p a -> a
$cmaximum :: forall p a. Ord a => HsRecFields p a -> a
elem :: a -> HsRecFields p a -> Bool
$celem :: forall p a. Eq a => a -> HsRecFields p a -> Bool
length :: HsRecFields p a -> Int
$clength :: forall p a. HsRecFields p a -> Int
null :: HsRecFields p a -> Bool
$cnull :: forall p a. HsRecFields p a -> Bool
toList :: HsRecFields p a -> [a]
$ctoList :: forall p a. HsRecFields p a -> [a]
foldl1 :: (a -> a -> a) -> HsRecFields p a -> a
$cfoldl1 :: forall p a. (a -> a -> a) -> HsRecFields p a -> a
foldr1 :: (a -> a -> a) -> HsRecFields p a -> a
$cfoldr1 :: forall p a. (a -> a -> a) -> HsRecFields p a -> a
foldl' :: (b -> a -> b) -> b -> HsRecFields p a -> b
$cfoldl' :: forall p b a. (b -> a -> b) -> b -> HsRecFields p a -> b
foldl :: (b -> a -> b) -> b -> HsRecFields p a -> b
$cfoldl :: forall p b a. (b -> a -> b) -> b -> HsRecFields p a -> b
foldr' :: (a -> b -> b) -> b -> HsRecFields p a -> b
$cfoldr' :: forall p a b. (a -> b -> b) -> b -> HsRecFields p a -> b
foldr :: (a -> b -> b) -> b -> HsRecFields p a -> b
$cfoldr :: forall p a b. (a -> b -> b) -> b -> HsRecFields p a -> b
foldMap' :: (a -> m) -> HsRecFields p a -> m
$cfoldMap' :: forall p m a. Monoid m => (a -> m) -> HsRecFields p a -> m
foldMap :: (a -> m) -> HsRecFields p a -> m
$cfoldMap :: forall p m a. Monoid m => (a -> m) -> HsRecFields p a -> m
fold :: HsRecFields p m -> m
$cfold :: forall p m. Monoid m => HsRecFields p m -> m
Foldable, Functor (HsRecFields p)
Foldable (HsRecFields p)
Functor (HsRecFields p)
-> Foldable (HsRecFields p)
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecFields p a -> f (HsRecFields p b))
-> (forall (f :: * -> *) a.
Applicative f =>
HsRecFields p (f a) -> f (HsRecFields p a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecFields p a -> m (HsRecFields p b))
-> (forall (m :: * -> *) a.
Monad m =>
HsRecFields p (m a) -> m (HsRecFields p a))
-> Traversable (HsRecFields p)
(a -> f b) -> HsRecFields p a -> f (HsRecFields p b)
forall p. Functor (HsRecFields p)
forall p. Foldable (HsRecFields p)
forall p (m :: * -> *) a.
Monad m =>
HsRecFields p (m a) -> m (HsRecFields p a)
forall p (f :: * -> *) a.
Applicative f =>
HsRecFields p (f a) -> f (HsRecFields p a)
forall p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecFields p a -> m (HsRecFields p b)
forall p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecFields p a -> f (HsRecFields p b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
HsRecFields p (m a) -> m (HsRecFields p a)
forall (f :: * -> *) a.
Applicative f =>
HsRecFields p (f a) -> f (HsRecFields p a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecFields p a -> m (HsRecFields p b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecFields p a -> f (HsRecFields p b)
sequence :: HsRecFields p (m a) -> m (HsRecFields p a)
$csequence :: forall p (m :: * -> *) a.
Monad m =>
HsRecFields p (m a) -> m (HsRecFields p a)
mapM :: (a -> m b) -> HsRecFields p a -> m (HsRecFields p b)
$cmapM :: forall p (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecFields p a -> m (HsRecFields p b)
sequenceA :: HsRecFields p (f a) -> f (HsRecFields p a)
$csequenceA :: forall p (f :: * -> *) a.
Applicative f =>
HsRecFields p (f a) -> f (HsRecFields p a)
traverse :: (a -> f b) -> HsRecFields p a -> f (HsRecFields p b)
$ctraverse :: forall p (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecFields p a -> f (HsRecFields p b)
$cp2Traversable :: forall p. Foldable (HsRecFields p)
$cp1Traversable :: forall p. Functor (HsRecFields p)
Traversable)
type LHsRecField' p arg = Located (HsRecField' p arg)
type LHsRecField p arg = Located (HsRecField p arg)
type LHsRecUpdField p = Located (HsRecUpdField p)
type HsRecField p arg = HsRecField' (FieldOcc p) arg
type HsRecUpdField p = HsRecField' (AmbiguousFieldOcc p) (LHsExpr p)
data HsRecField' id arg = HsRecField {
HsRecField' id arg -> Located id
hsRecFieldLbl :: Located id,
HsRecField' id arg -> arg
hsRecFieldArg :: arg,
HsRecField' id arg -> Bool
hsRecPun :: Bool
} deriving (Typeable (HsRecField' id arg)
DataType
Constr
Typeable (HsRecField' id arg)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg))
-> (HsRecField' id arg -> Constr)
-> (HsRecField' id arg -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg)))
-> ((forall b. Data b => b -> b)
-> HsRecField' id arg -> HsRecField' id arg)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r)
-> (forall u.
(forall d. Data d => d -> u) -> HsRecField' id arg -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg))
-> Data (HsRecField' id arg)
HsRecField' id arg -> DataType
HsRecField' id arg -> Constr
(forall b. Data b => b -> b)
-> HsRecField' id arg -> HsRecField' id arg
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u
forall u. (forall d. Data d => d -> u) -> HsRecField' id arg -> [u]
forall id arg. (Data id, Data arg) => Typeable (HsRecField' id arg)
forall id arg.
(Data id, Data arg) =>
HsRecField' id arg -> DataType
forall id arg. (Data id, Data arg) => HsRecField' id arg -> Constr
forall id arg.
(Data id, Data arg) =>
(forall b. Data b => b -> b)
-> HsRecField' id arg -> HsRecField' id arg
forall id arg u.
(Data id, Data arg) =>
Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u
forall id arg u.
(Data id, Data arg) =>
(forall d. Data d => d -> u) -> HsRecField' id arg -> [u]
forall id arg r r'.
(Data id, Data arg) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
forall id arg r r'.
(Data id, Data arg) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
forall id arg (m :: * -> *).
(Data id, Data arg, Monad m) =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
forall id arg (m :: * -> *).
(Data id, Data arg, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
forall id arg (c :: * -> *).
(Data id, Data arg) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg)
forall id arg (c :: * -> *).
(Data id, Data arg) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg)
forall id arg (t :: * -> *) (c :: * -> *).
(Data id, Data arg, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg))
forall id arg (t :: * -> * -> *) (c :: * -> *).
(Data id, Data arg, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg))
$cHsRecField :: Constr
$tHsRecField' :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
$cgmapMo :: forall id arg (m :: * -> *).
(Data id, Data arg, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
gmapMp :: (forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
$cgmapMp :: forall id arg (m :: * -> *).
(Data id, Data arg, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
gmapM :: (forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
$cgmapM :: forall id arg (m :: * -> *).
(Data id, Data arg, Monad m) =>
(forall d. Data d => d -> m d)
-> HsRecField' id arg -> m (HsRecField' id arg)
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u
$cgmapQi :: forall id arg u.
(Data id, Data arg) =>
Int -> (forall d. Data d => d -> u) -> HsRecField' id arg -> u
gmapQ :: (forall d. Data d => d -> u) -> HsRecField' id arg -> [u]
$cgmapQ :: forall id arg u.
(Data id, Data arg) =>
(forall d. Data d => d -> u) -> HsRecField' id arg -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
$cgmapQr :: forall id arg r r'.
(Data id, Data arg) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
$cgmapQl :: forall id arg r r'.
(Data id, Data arg) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsRecField' id arg -> r
gmapT :: (forall b. Data b => b -> b)
-> HsRecField' id arg -> HsRecField' id arg
$cgmapT :: forall id arg.
(Data id, Data arg) =>
(forall b. Data b => b -> b)
-> HsRecField' id arg -> HsRecField' id arg
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg))
$cdataCast2 :: forall id arg (t :: * -> * -> *) (c :: * -> *).
(Data id, Data arg, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsRecField' id arg))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg))
$cdataCast1 :: forall id arg (t :: * -> *) (c :: * -> *).
(Data id, Data arg, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HsRecField' id arg))
dataTypeOf :: HsRecField' id arg -> DataType
$cdataTypeOf :: forall id arg.
(Data id, Data arg) =>
HsRecField' id arg -> DataType
toConstr :: HsRecField' id arg -> Constr
$ctoConstr :: forall id arg. (Data id, Data arg) => HsRecField' id arg -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg)
$cgunfold :: forall id arg (c :: * -> *).
(Data id, Data arg) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsRecField' id arg)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg)
$cgfoldl :: forall id arg (c :: * -> *).
(Data id, Data arg) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsRecField' id arg
-> c (HsRecField' id arg)
$cp1Data :: forall id arg. (Data id, Data arg) => Typeable (HsRecField' id arg)
Data, a -> HsRecField' id b -> HsRecField' id a
(a -> b) -> HsRecField' id a -> HsRecField' id b
(forall a b. (a -> b) -> HsRecField' id a -> HsRecField' id b)
-> (forall a b. a -> HsRecField' id b -> HsRecField' id a)
-> Functor (HsRecField' id)
forall a b. a -> HsRecField' id b -> HsRecField' id a
forall a b. (a -> b) -> HsRecField' id a -> HsRecField' id b
forall id a b. a -> HsRecField' id b -> HsRecField' id a
forall id a b. (a -> b) -> HsRecField' id a -> HsRecField' id b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> HsRecField' id b -> HsRecField' id a
$c<$ :: forall id a b. a -> HsRecField' id b -> HsRecField' id a
fmap :: (a -> b) -> HsRecField' id a -> HsRecField' id b
$cfmap :: forall id a b. (a -> b) -> HsRecField' id a -> HsRecField' id b
Functor, HsRecField' id a -> Bool
(a -> m) -> HsRecField' id a -> m
(a -> b -> b) -> b -> HsRecField' id a -> b
(forall m. Monoid m => HsRecField' id m -> m)
-> (forall m a. Monoid m => (a -> m) -> HsRecField' id a -> m)
-> (forall m a. Monoid m => (a -> m) -> HsRecField' id a -> m)
-> (forall a b. (a -> b -> b) -> b -> HsRecField' id a -> b)
-> (forall a b. (a -> b -> b) -> b -> HsRecField' id a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsRecField' id a -> b)
-> (forall b a. (b -> a -> b) -> b -> HsRecField' id a -> b)
-> (forall a. (a -> a -> a) -> HsRecField' id a -> a)
-> (forall a. (a -> a -> a) -> HsRecField' id a -> a)
-> (forall a. HsRecField' id a -> [a])
-> (forall a. HsRecField' id a -> Bool)
-> (forall a. HsRecField' id a -> Int)
-> (forall a. Eq a => a -> HsRecField' id a -> Bool)
-> (forall a. Ord a => HsRecField' id a -> a)
-> (forall a. Ord a => HsRecField' id a -> a)
-> (forall a. Num a => HsRecField' id a -> a)
-> (forall a. Num a => HsRecField' id a -> a)
-> Foldable (HsRecField' id)
forall a. Eq a => a -> HsRecField' id a -> Bool
forall a. Num a => HsRecField' id a -> a
forall a. Ord a => HsRecField' id a -> a
forall m. Monoid m => HsRecField' id m -> m
forall a. HsRecField' id a -> Bool
forall a. HsRecField' id a -> Int
forall a. HsRecField' id a -> [a]
forall a. (a -> a -> a) -> HsRecField' id a -> a
forall id a. Eq a => a -> HsRecField' id a -> Bool
forall id a. Num a => HsRecField' id a -> a
forall id a. Ord a => HsRecField' id a -> a
forall m a. Monoid m => (a -> m) -> HsRecField' id a -> m
forall id m. Monoid m => HsRecField' id m -> m
forall id a. HsRecField' id a -> Bool
forall id a. HsRecField' id a -> Int
forall id a. HsRecField' id a -> [a]
forall b a. (b -> a -> b) -> b -> HsRecField' id a -> b
forall a b. (a -> b -> b) -> b -> HsRecField' id a -> b
forall id a. (a -> a -> a) -> HsRecField' id a -> a
forall id m a. Monoid m => (a -> m) -> HsRecField' id a -> m
forall id b a. (b -> a -> b) -> b -> HsRecField' id a -> b
forall id a b. (a -> b -> b) -> b -> HsRecField' id a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: HsRecField' id a -> a
$cproduct :: forall id a. Num a => HsRecField' id a -> a
sum :: HsRecField' id a -> a
$csum :: forall id a. Num a => HsRecField' id a -> a
minimum :: HsRecField' id a -> a
$cminimum :: forall id a. Ord a => HsRecField' id a -> a
maximum :: HsRecField' id a -> a
$cmaximum :: forall id a. Ord a => HsRecField' id a -> a
elem :: a -> HsRecField' id a -> Bool
$celem :: forall id a. Eq a => a -> HsRecField' id a -> Bool
length :: HsRecField' id a -> Int
$clength :: forall id a. HsRecField' id a -> Int
null :: HsRecField' id a -> Bool
$cnull :: forall id a. HsRecField' id a -> Bool
toList :: HsRecField' id a -> [a]
$ctoList :: forall id a. HsRecField' id a -> [a]
foldl1 :: (a -> a -> a) -> HsRecField' id a -> a
$cfoldl1 :: forall id a. (a -> a -> a) -> HsRecField' id a -> a
foldr1 :: (a -> a -> a) -> HsRecField' id a -> a
$cfoldr1 :: forall id a. (a -> a -> a) -> HsRecField' id a -> a
foldl' :: (b -> a -> b) -> b -> HsRecField' id a -> b
$cfoldl' :: forall id b a. (b -> a -> b) -> b -> HsRecField' id a -> b
foldl :: (b -> a -> b) -> b -> HsRecField' id a -> b
$cfoldl :: forall id b a. (b -> a -> b) -> b -> HsRecField' id a -> b
foldr' :: (a -> b -> b) -> b -> HsRecField' id a -> b
$cfoldr' :: forall id a b. (a -> b -> b) -> b -> HsRecField' id a -> b
foldr :: (a -> b -> b) -> b -> HsRecField' id a -> b
$cfoldr :: forall id a b. (a -> b -> b) -> b -> HsRecField' id a -> b
foldMap' :: (a -> m) -> HsRecField' id a -> m
$cfoldMap' :: forall id m a. Monoid m => (a -> m) -> HsRecField' id a -> m
foldMap :: (a -> m) -> HsRecField' id a -> m
$cfoldMap :: forall id m a. Monoid m => (a -> m) -> HsRecField' id a -> m
fold :: HsRecField' id m -> m
$cfold :: forall id m. Monoid m => HsRecField' id m -> m
Foldable, Functor (HsRecField' id)
Foldable (HsRecField' id)
Functor (HsRecField' id)
-> Foldable (HsRecField' id)
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecField' id a -> f (HsRecField' id b))
-> (forall (f :: * -> *) a.
Applicative f =>
HsRecField' id (f a) -> f (HsRecField' id a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecField' id a -> m (HsRecField' id b))
-> (forall (m :: * -> *) a.
Monad m =>
HsRecField' id (m a) -> m (HsRecField' id a))
-> Traversable (HsRecField' id)
(a -> f b) -> HsRecField' id a -> f (HsRecField' id b)
forall id. Functor (HsRecField' id)
forall id. Foldable (HsRecField' id)
forall id (m :: * -> *) a.
Monad m =>
HsRecField' id (m a) -> m (HsRecField' id a)
forall id (f :: * -> *) a.
Applicative f =>
HsRecField' id (f a) -> f (HsRecField' id a)
forall id (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecField' id a -> m (HsRecField' id b)
forall id (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecField' id a -> f (HsRecField' id b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
HsRecField' id (m a) -> m (HsRecField' id a)
forall (f :: * -> *) a.
Applicative f =>
HsRecField' id (f a) -> f (HsRecField' id a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecField' id a -> m (HsRecField' id b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecField' id a -> f (HsRecField' id b)
sequence :: HsRecField' id (m a) -> m (HsRecField' id a)
$csequence :: forall id (m :: * -> *) a.
Monad m =>
HsRecField' id (m a) -> m (HsRecField' id a)
mapM :: (a -> m b) -> HsRecField' id a -> m (HsRecField' id b)
$cmapM :: forall id (m :: * -> *) a b.
Monad m =>
(a -> m b) -> HsRecField' id a -> m (HsRecField' id b)
sequenceA :: HsRecField' id (f a) -> f (HsRecField' id a)
$csequenceA :: forall id (f :: * -> *) a.
Applicative f =>
HsRecField' id (f a) -> f (HsRecField' id a)
traverse :: (a -> f b) -> HsRecField' id a -> f (HsRecField' id b)
$ctraverse :: forall id (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> HsRecField' id a -> f (HsRecField' id b)
$cp2Traversable :: forall id. Foldable (HsRecField' id)
$cp1Traversable :: forall id. Functor (HsRecField' id)
Traversable)
hsRecFields :: HsRecFields p arg -> [XCFieldOcc p]
hsRecFields :: HsRecFields p arg -> [XCFieldOcc p]
hsRecFields HsRecFields p arg
rbinds = (LHsRecField p arg -> XCFieldOcc p)
-> [LHsRecField p arg] -> [XCFieldOcc p]
forall a b. (a -> b) -> [a] -> [b]
map (Located (XCFieldOcc p) -> XCFieldOcc p
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc (Located (XCFieldOcc p) -> XCFieldOcc p)
-> (LHsRecField p arg -> Located (XCFieldOcc p))
-> LHsRecField p arg
-> XCFieldOcc p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsRecField p arg -> Located (XCFieldOcc p)
forall pass arg. HsRecField pass arg -> Located (XCFieldOcc pass)
hsRecFieldSel (HsRecField p arg -> Located (XCFieldOcc p))
-> (LHsRecField p arg -> HsRecField p arg)
-> LHsRecField p arg
-> Located (XCFieldOcc p)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsRecField p arg -> HsRecField p arg
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc) (HsRecFields p arg -> [LHsRecField p arg]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p arg
rbinds)
hsRecFieldsArgs :: HsRecFields p arg -> [arg]
hsRecFieldsArgs :: HsRecFields p arg -> [arg]
hsRecFieldsArgs HsRecFields p arg
rbinds = (LHsRecField p arg -> arg) -> [LHsRecField p arg] -> [arg]
forall a b. (a -> b) -> [a] -> [b]
map (HsRecField' (FieldOcc p) arg -> arg
forall id arg. HsRecField' id arg -> arg
hsRecFieldArg (HsRecField' (FieldOcc p) arg -> arg)
-> (LHsRecField p arg -> HsRecField' (FieldOcc p) arg)
-> LHsRecField p arg
-> arg
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsRecField p arg -> HsRecField' (FieldOcc p) arg
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc) (HsRecFields p arg -> [LHsRecField p arg]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields p arg
rbinds)
hsRecFieldSel :: HsRecField pass arg -> Located (XCFieldOcc pass)
hsRecFieldSel :: HsRecField pass arg -> Located (XCFieldOcc pass)
hsRecFieldSel = (FieldOcc pass -> XCFieldOcc pass)
-> GenLocated SrcSpan (FieldOcc pass) -> Located (XCFieldOcc pass)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap FieldOcc pass -> XCFieldOcc pass
forall pass. FieldOcc pass -> XCFieldOcc pass
extFieldOcc (GenLocated SrcSpan (FieldOcc pass) -> Located (XCFieldOcc pass))
-> (HsRecField pass arg -> GenLocated SrcSpan (FieldOcc pass))
-> HsRecField pass arg
-> Located (XCFieldOcc pass)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsRecField pass arg -> GenLocated SrcSpan (FieldOcc pass)
forall id arg. HsRecField' id arg -> Located id
hsRecFieldLbl
hsRecFieldId :: HsRecField GhcTc arg -> Located Id
hsRecFieldId :: HsRecField GhcTc arg -> Located TyVar
hsRecFieldId = HsRecField GhcTc arg -> Located TyVar
forall pass arg. HsRecField pass arg -> Located (XCFieldOcc pass)
hsRecFieldSel
hsRecUpdFieldRdr :: HsRecUpdField (GhcPass p) -> Located RdrName
hsRecUpdFieldRdr :: HsRecUpdField (GhcPass p) -> Located RdrName
hsRecUpdFieldRdr = (AmbiguousFieldOcc (GhcPass p) -> RdrName)
-> GenLocated SrcSpan (AmbiguousFieldOcc (GhcPass p))
-> Located RdrName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AmbiguousFieldOcc (GhcPass p) -> RdrName
forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc (GenLocated SrcSpan (AmbiguousFieldOcc (GhcPass p))
-> Located RdrName)
-> (HsRecUpdField (GhcPass p)
-> GenLocated SrcSpan (AmbiguousFieldOcc (GhcPass p)))
-> HsRecUpdField (GhcPass p)
-> Located RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsRecUpdField (GhcPass p)
-> GenLocated SrcSpan (AmbiguousFieldOcc (GhcPass p))
forall id arg. HsRecField' id arg -> Located id
hsRecFieldLbl
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> Located Id
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> Located TyVar
hsRecUpdFieldId = (FieldOcc GhcTc -> TyVar)
-> GenLocated SrcSpan (FieldOcc GhcTc) -> Located TyVar
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap FieldOcc GhcTc -> TyVar
forall pass. FieldOcc pass -> XCFieldOcc pass
extFieldOcc (GenLocated SrcSpan (FieldOcc GhcTc) -> Located TyVar)
-> (HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (FieldOcc GhcTc))
-> HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> Located TyVar
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (FieldOcc GhcTc)
forall arg.
HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (FieldOcc GhcTc)
hsRecUpdFieldOcc
hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc GhcTc) arg -> LFieldOcc GhcTc
hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (FieldOcc GhcTc)
hsRecUpdFieldOcc = (AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc)
-> GenLocated SrcSpan (AmbiguousFieldOcc GhcTc)
-> GenLocated SrcSpan (FieldOcc GhcTc)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc
unambiguousFieldOcc (GenLocated SrcSpan (AmbiguousFieldOcc GhcTc)
-> GenLocated SrcSpan (FieldOcc GhcTc))
-> (HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (AmbiguousFieldOcc GhcTc))
-> HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (FieldOcc GhcTc)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsRecField' (AmbiguousFieldOcc GhcTc) arg
-> GenLocated SrcSpan (AmbiguousFieldOcc GhcTc)
forall id arg. HsRecField' id arg -> Located id
hsRecFieldLbl
instance (p ~ GhcPass pass, OutputableBndrId p) => Outputable (Pat p) where
ppr :: Pat p -> SDoc
ppr = Pat p -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Pat (GhcPass p) -> SDoc
pprPat
pprPatBndr :: OutputableBndr name => name -> SDoc
pprPatBndr :: name -> SDoc
pprPatBndr name
var
= (PprStyle -> SDoc) -> SDoc
getPprStyle ((PprStyle -> SDoc) -> SDoc) -> (PprStyle -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \ PprStyle
sty ->
if PprStyle -> Bool
debugStyle PprStyle
sty then
SDoc -> SDoc
parens (BindingSite -> name -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
LambdaBind name
var)
else
name -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc name
var
pprParendLPat :: (OutputableBndrId (GhcPass p))
=> PprPrec -> LPat (GhcPass p) -> SDoc
pprParendLPat :: PprPrec -> LPat (GhcPass p) -> SDoc
pprParendLPat PprPrec
p = PprPrec -> LPat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendPat PprPrec
p (LPat (GhcPass p) -> SDoc)
-> (LPat (GhcPass p) -> LPat (GhcPass p))
-> LPat (GhcPass p)
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LPat (GhcPass p) -> LPat (GhcPass p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
pprParendPat :: (OutputableBndrId (GhcPass p))
=> PprPrec -> Pat (GhcPass p) -> SDoc
pprParendPat :: PprPrec -> Pat (GhcPass p) -> SDoc
pprParendPat PprPrec
p Pat (GhcPass p)
pat = (DynFlags -> SDoc) -> SDoc
sdocWithDynFlags ((DynFlags -> SDoc) -> SDoc) -> (DynFlags -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \ DynFlags
dflags ->
if DynFlags -> Pat (GhcPass p) -> Bool
need_parens DynFlags
dflags Pat (GhcPass p)
pat
then SDoc -> SDoc
parens (Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Pat (GhcPass p) -> SDoc
pprPat Pat (GhcPass p)
pat)
else Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Pat (GhcPass p) -> SDoc
pprPat Pat (GhcPass p)
pat
where
need_parens :: DynFlags -> Pat (GhcPass p) -> Bool
need_parens DynFlags
dflags Pat (GhcPass p)
pat
| CoPat {} <- Pat (GhcPass p)
pat = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintTypecheckerElaboration DynFlags
dflags
| Bool
otherwise = PprPrec -> Pat (GhcPass p) -> Bool
forall p. PprPrec -> Pat p -> Bool
patNeedsParens PprPrec
p Pat (GhcPass p)
pat
pprPat :: (OutputableBndrId (GhcPass p)) => Pat (GhcPass p) -> SDoc
pprPat :: Pat (GhcPass p) -> SDoc
pprPat (VarPat XVarPat (GhcPass p)
_ Located (IdP (GhcPass p))
lvar) = IdP (GhcPass p) -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPatBndr (Located (IdP (GhcPass p))
-> SrcSpanLess (Located (IdP (GhcPass p)))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located (IdP (GhcPass p))
lvar)
pprPat (WildPat XWildPat (GhcPass p)
_) = Char -> SDoc
char Char
'_'
pprPat (LazyPat XLazyPat (GhcPass p)
_ Pat (GhcPass p)
pat) = Char -> SDoc
char Char
'~' SDoc -> SDoc -> SDoc
<> PprPrec -> Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec Pat (GhcPass p)
pat
pprPat (BangPat XBangPat (GhcPass p)
_ Pat (GhcPass p)
pat) = Char -> SDoc
char Char
'!' SDoc -> SDoc -> SDoc
<> PprPrec -> Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec Pat (GhcPass p)
pat
pprPat (AsPat XAsPat (GhcPass p)
_ Located (IdP (GhcPass p))
name Pat (GhcPass p)
pat) = [SDoc] -> SDoc
hcat [IdP (GhcPass p) -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc (Located (IdP (GhcPass p))
-> SrcSpanLess (Located (IdP (GhcPass p)))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located (IdP (GhcPass p))
name), Char -> SDoc
char Char
'@',
PprPrec -> Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec Pat (GhcPass p)
pat]
pprPat (ViewPat XViewPat (GhcPass p)
_ LHsExpr (GhcPass p)
expr Pat (GhcPass p)
pat) = [SDoc] -> SDoc
hcat [LHsExpr (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsExpr (GhcPass p) -> SDoc
pprLExpr LHsExpr (GhcPass p)
expr, String -> SDoc
text String
" -> ", Pat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat (GhcPass p)
pat]
pprPat (ParPat XParPat (GhcPass p)
_ Pat (GhcPass p)
pat) = SDoc -> SDoc
parens (Pat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat (GhcPass p)
pat)
pprPat (LitPat XLitPat (GhcPass p)
_ HsLit (GhcPass p)
s) = HsLit (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsLit (GhcPass p)
s
pprPat (NPat XNPat (GhcPass p)
_ Located (HsOverLit (GhcPass p))
l Maybe (SyntaxExpr (GhcPass p))
Nothing SyntaxExpr (GhcPass p)
_) = Located (HsOverLit (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (HsOverLit (GhcPass p))
l
pprPat (NPat XNPat (GhcPass p)
_ Located (HsOverLit (GhcPass p))
l (Just SyntaxExpr (GhcPass p)
_) SyntaxExpr (GhcPass p)
_) = Char -> SDoc
char Char
'-' SDoc -> SDoc -> SDoc
<> Located (HsOverLit (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (HsOverLit (GhcPass p))
l
pprPat (NPlusKPat XNPlusKPat (GhcPass p)
_ Located (IdP (GhcPass p))
n Located (HsOverLit (GhcPass p))
k HsOverLit (GhcPass p)
_ SyntaxExpr (GhcPass p)
_ SyntaxExpr (GhcPass p)
_) = [SDoc] -> SDoc
hcat [Located (IdP (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdP (GhcPass p))
n, Char -> SDoc
char Char
'+', Located (HsOverLit (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (HsOverLit (GhcPass p))
k]
pprPat (SplicePat XSplicePat (GhcPass p)
_ HsSplice (GhcPass p)
splice) = HsSplice (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsSplice (GhcPass p) -> SDoc
pprSplice HsSplice (GhcPass p)
splice
pprPat (CoPat XCoPat (GhcPass p)
_ HsWrapper
co Pat (GhcPass p)
pat Type
_) = HsWrapper -> (Bool -> SDoc) -> SDoc
pprHsWrapper HsWrapper
co ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \Bool
parens
-> if Bool
parens
then PprPrec -> Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendPat PprPrec
appPrec Pat (GhcPass p)
pat
else Pat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Pat (GhcPass p) -> SDoc
pprPat Pat (GhcPass p)
pat
pprPat (SigPat XSigPat (GhcPass p)
_ Pat (GhcPass p)
pat LHsSigWcType (NoGhcTc (GhcPass p))
ty) = Pat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat (GhcPass p)
pat SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> LHsSigWcType (GhcPass (NoGhcTcPass (NoGhcTcPass p))) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigWcType (NoGhcTc (GhcPass p))
LHsSigWcType (GhcPass (NoGhcTcPass (NoGhcTcPass p)))
ty
pprPat (ListPat XListPat (GhcPass p)
_ [Pat (GhcPass p)]
pats) = SDoc -> SDoc
brackets ([Pat (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [Pat (GhcPass p)]
pats)
pprPat (TuplePat XTuplePat (GhcPass p)
_ [Pat (GhcPass p)]
pats Boxity
bx) = TupleSort -> SDoc -> SDoc
tupleParens (Boxity -> TupleSort
boxityTupleSort Boxity
bx)
((Pat (GhcPass p) -> SDoc) -> [Pat (GhcPass p)] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithCommas Pat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Pat (GhcPass p)]
pats)
pprPat (SumPat XSumPat (GhcPass p)
_ Pat (GhcPass p)
pat Int
alt Int
arity) = SDoc -> SDoc
sumParens ((Pat (GhcPass p) -> SDoc) -> Pat (GhcPass p) -> Int -> Int -> SDoc
forall a. (a -> SDoc) -> a -> Int -> Int -> SDoc
pprAlternative Pat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat (GhcPass p)
pat Int
alt Int
arity)
pprPat (ConPatIn Located (IdP (GhcPass p))
con HsConPatDetails (GhcPass p)
details) = IdP (GhcPass p) -> HsConPatDetails (GhcPass p) -> SDoc
forall con (p :: Pass).
(OutputableBndr con, OutputableBndrId (GhcPass p)) =>
con -> HsConPatDetails (GhcPass p) -> SDoc
pprUserCon (Located (IdP (GhcPass p))
-> SrcSpanLess (Located (IdP (GhcPass p)))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located (IdP (GhcPass p))
con) HsConPatDetails (GhcPass p)
details
pprPat (ConPatOut { pat_con :: forall p. Pat p -> Located ConLike
pat_con = Located ConLike
con
, pat_tvs :: forall p. Pat p -> [TyVar]
pat_tvs = [TyVar]
tvs
, pat_dicts :: forall p. Pat p -> [TyVar]
pat_dicts = [TyVar]
dicts
, pat_binds :: forall p. Pat p -> TcEvBinds
pat_binds = TcEvBinds
binds
, pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args = HsConPatDetails (GhcPass p)
details })
= (DynFlags -> SDoc) -> SDoc
sdocWithDynFlags ((DynFlags -> SDoc) -> SDoc) -> (DynFlags -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \DynFlags
dflags ->
if GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintTypecheckerElaboration DynFlags
dflags then
Located ConLike -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located ConLike
con
SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
braces ([SDoc] -> SDoc
sep [ [SDoc] -> SDoc
hsep ((TyVar -> SDoc) -> [TyVar] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map TyVar -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPatBndr ([TyVar]
tvs [TyVar] -> [TyVar] -> [TyVar]
forall a. [a] -> [a] -> [a]
++ [TyVar]
dicts))
, TcEvBinds -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcEvBinds
binds])
SDoc -> SDoc -> SDoc
<+> HsConPatDetails (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsConPatDetails (GhcPass p) -> SDoc
pprConArgs HsConPatDetails (GhcPass p)
details
else ConLike -> HsConPatDetails (GhcPass p) -> SDoc
forall con (p :: Pass).
(OutputableBndr con, OutputableBndrId (GhcPass p)) =>
con -> HsConPatDetails (GhcPass p) -> SDoc
pprUserCon (Located ConLike -> SrcSpanLess (Located ConLike)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located ConLike
con) HsConPatDetails (GhcPass p)
details
pprPat (XPat XXPat (GhcPass p)
x) = Located (Pat (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (Pat (GhcPass p))
XXPat (GhcPass p)
x
pprUserCon :: (OutputableBndr con, OutputableBndrId (GhcPass p))
=> con -> HsConPatDetails (GhcPass p) -> SDoc
pprUserCon :: con -> HsConPatDetails (GhcPass p) -> SDoc
pprUserCon con
c (InfixCon LPat (GhcPass p)
p1 LPat (GhcPass p)
p2) = LPat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LPat (GhcPass p)
p1 SDoc -> SDoc -> SDoc
<+> con -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc con
c SDoc -> SDoc -> SDoc
<+> LPat (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LPat (GhcPass p)
p2
pprUserCon con
c HsConPatDetails (GhcPass p)
details = con -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc con
c SDoc -> SDoc -> SDoc
<+> HsConPatDetails (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsConPatDetails (GhcPass p) -> SDoc
pprConArgs HsConPatDetails (GhcPass p)
details
pprConArgs :: (OutputableBndrId (GhcPass p))
=> HsConPatDetails (GhcPass p) -> SDoc
pprConArgs :: HsConPatDetails (GhcPass p) -> SDoc
pprConArgs (PrefixCon [LPat (GhcPass p)]
pats) = [SDoc] -> SDoc
sep ((LPat (GhcPass p) -> SDoc) -> [LPat (GhcPass p)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (PprPrec -> LPat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec) [LPat (GhcPass p)]
pats)
pprConArgs (InfixCon LPat (GhcPass p)
p1 LPat (GhcPass p)
p2) = [SDoc] -> SDoc
sep [ PprPrec -> LPat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec LPat (GhcPass p)
p1
, PprPrec -> LPat (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
PprPrec -> Pat (GhcPass p) -> SDoc
pprParendLPat PprPrec
appPrec LPat (GhcPass p)
p2 ]
pprConArgs (RecCon HsRecFields (GhcPass p) (LPat (GhcPass p))
rpats) = HsRecFields (GhcPass p) (LPat (GhcPass p)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsRecFields (GhcPass p) (LPat (GhcPass p))
rpats
instance (Outputable arg)
=> Outputable (HsRecFields p arg) where
ppr :: HsRecFields p arg -> SDoc
ppr (HsRecFields { rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds = [LHsRecField p arg]
flds, rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe Int
rec_dotdot = Maybe Int
Nothing })
= SDoc -> SDoc
braces ([SDoc] -> SDoc
fsep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((LHsRecField p arg -> SDoc) -> [LHsRecField p arg] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LHsRecField p arg -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LHsRecField p arg]
flds)))
ppr (HsRecFields { rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds = [LHsRecField p arg]
flds, rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe Int
rec_dotdot = Just Int
n })
= SDoc -> SDoc
braces ([SDoc] -> SDoc
fsep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((LHsRecField p arg -> SDoc) -> [LHsRecField p arg] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LHsRecField p arg -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Int -> [LHsRecField p arg] -> [LHsRecField p arg]
forall a. Int -> [a] -> [a]
take Int
n [LHsRecField p arg]
flds) [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [SDoc
dotdot])))
where
dotdot :: SDoc
dotdot = String -> SDoc
text String
".." SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
whenPprDebug ([LHsRecField p arg] -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Int -> [LHsRecField p arg] -> [LHsRecField p arg]
forall a. Int -> [a] -> [a]
drop Int
n [LHsRecField p arg]
flds))
instance (Outputable p, Outputable arg)
=> Outputable (HsRecField' p arg) where
ppr :: HsRecField' p arg -> SDoc
ppr (HsRecField { hsRecFieldLbl :: forall id arg. HsRecField' id arg -> Located id
hsRecFieldLbl = Located p
f, hsRecFieldArg :: forall id arg. HsRecField' id arg -> arg
hsRecFieldArg = arg
arg,
hsRecPun :: forall id a. HsRecField' id a -> Bool
hsRecPun = Bool
pun })
= Located p -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located p
f SDoc -> SDoc -> SDoc
<+> (Bool -> SDoc -> SDoc
ppUnless Bool
pun (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc
equals SDoc -> SDoc -> SDoc
<+> arg -> SDoc
forall a. Outputable a => a -> SDoc
ppr arg
arg)
mkPrefixConPat :: DataCon ->
[OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
mkPrefixConPat :: DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
mkPrefixConPat DataCon
dc [OutPat (GhcPass p)]
pats [Type]
tys
= SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p)
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc (SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p))
-> SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p)
forall a b. (a -> b) -> a -> b
$ ConPatOut :: forall p.
Located ConLike
-> [Type]
-> [TyVar]
-> [TyVar]
-> TcEvBinds
-> HsConPatDetails p
-> HsWrapper
-> Pat p
ConPatOut { pat_con :: Located ConLike
pat_con = SrcSpanLess (Located ConLike) -> Located ConLike
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc (DataCon -> ConLike
RealDataCon DataCon
dc)
, pat_tvs :: [TyVar]
pat_tvs = []
, pat_dicts :: [TyVar]
pat_dicts = []
, pat_binds :: TcEvBinds
pat_binds = TcEvBinds
emptyTcEvBinds
, pat_args :: HsConPatDetails (GhcPass p)
pat_args = [OutPat (GhcPass p)] -> HsConPatDetails (GhcPass p)
forall arg rec. [arg] -> HsConDetails arg rec
PrefixCon [OutPat (GhcPass p)]
pats
, pat_arg_tys :: [Type]
pat_arg_tys = [Type]
tys
, pat_wrap :: HsWrapper
pat_wrap = HsWrapper
idHsWrapper }
mkNilPat :: Type -> OutPat (GhcPass p)
mkNilPat :: Type -> OutPat (GhcPass p)
mkNilPat Type
ty = DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
forall (p :: Pass).
DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
mkPrefixConPat DataCon
nilDataCon [] [Type
ty]
mkCharLitPat :: SourceText -> Char -> OutPat (GhcPass p)
mkCharLitPat :: SourceText -> Char -> OutPat (GhcPass p)
mkCharLitPat SourceText
src Char
c = DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
forall (p :: Pass).
DataCon -> [OutPat (GhcPass p)] -> [Type] -> OutPat (GhcPass p)
mkPrefixConPat DataCon
charDataCon
[SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p)
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc (SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p))
-> SrcSpanLess (OutPat (GhcPass p)) -> OutPat (GhcPass p)
forall a b. (a -> b) -> a -> b
$ XLitPat (GhcPass p) -> HsLit (GhcPass p) -> OutPat (GhcPass p)
forall p. XLitPat p -> HsLit p -> Pat p
LitPat XLitPat (GhcPass p)
NoExt
NoExt (XHsCharPrim (GhcPass p) -> Char -> HsLit (GhcPass p)
forall x. XHsCharPrim x -> Char -> HsLit x
HsCharPrim SourceText
XHsCharPrim (GhcPass p)
src Char
c)] []
isBangedLPat :: LPat (GhcPass p) -> Bool
isBangedLPat :: LPat (GhcPass p) -> Bool
isBangedLPat = LPat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
isBangedPat (LPat (GhcPass p) -> Bool)
-> (LPat (GhcPass p) -> LPat (GhcPass p))
-> LPat (GhcPass p)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LPat (GhcPass p) -> LPat (GhcPass p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
isBangedPat :: Pat (GhcPass p) -> Bool
isBangedPat :: Pat (GhcPass p) -> Bool
isBangedPat (ParPat XParPat (GhcPass p)
_ Pat (GhcPass p)
p) = Pat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
isBangedLPat Pat (GhcPass p)
p
isBangedPat (BangPat {}) = Bool
True
isBangedPat Pat (GhcPass p)
_ = Bool
False
looksLazyPatBind :: HsBind (GhcPass p) -> Bool
looksLazyPatBind :: HsBind (GhcPass p) -> Bool
looksLazyPatBind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat (GhcPass p)
p })
= LPat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
looksLazyLPat LPat (GhcPass p)
p
looksLazyPatBind (AbsBinds { abs_binds :: forall idL idR. HsBindLR idL idR -> LHsBinds idL
abs_binds = LHsBinds (GhcPass p)
binds })
= (LHsBindLR (GhcPass p) (GhcPass p) -> Bool)
-> LHsBinds (GhcPass p) -> Bool
forall a. (a -> Bool) -> Bag a -> Bool
anyBag (HsBind (GhcPass p) -> Bool
forall (p :: Pass). HsBind (GhcPass p) -> Bool
looksLazyPatBind (HsBind (GhcPass p) -> Bool)
-> (LHsBindLR (GhcPass p) (GhcPass p) -> HsBind (GhcPass p))
-> LHsBindLR (GhcPass p) (GhcPass p)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsBindLR (GhcPass p) (GhcPass p) -> HsBind (GhcPass p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc) LHsBinds (GhcPass p)
binds
looksLazyPatBind HsBind (GhcPass p)
_
= Bool
False
looksLazyLPat :: LPat (GhcPass p) -> Bool
looksLazyLPat :: LPat (GhcPass p) -> Bool
looksLazyLPat = LPat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
looksLazyPat (LPat (GhcPass p) -> Bool)
-> (LPat (GhcPass p) -> LPat (GhcPass p))
-> LPat (GhcPass p)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LPat (GhcPass p) -> LPat (GhcPass p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
looksLazyPat :: Pat (GhcPass p) -> Bool
looksLazyPat :: Pat (GhcPass p) -> Bool
looksLazyPat (ParPat XParPat (GhcPass p)
_ Pat (GhcPass p)
p) = Pat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
looksLazyLPat Pat (GhcPass p)
p
looksLazyPat (AsPat XAsPat (GhcPass p)
_ Located (IdP (GhcPass p))
_ Pat (GhcPass p)
p) = Pat (GhcPass p) -> Bool
forall (p :: Pass). Pat (GhcPass p) -> Bool
looksLazyLPat Pat (GhcPass p)
p
looksLazyPat (BangPat {}) = Bool
False
looksLazyPat (VarPat {}) = Bool
False
looksLazyPat (WildPat {}) = Bool
False
looksLazyPat Pat (GhcPass p)
_ = Bool
True
isIrrefutableHsPat :: (OutputableBndrId (GhcPass p)) => LPat (GhcPass p) -> Bool
isIrrefutableHsPat :: LPat (GhcPass p) -> Bool
isIrrefutableHsPat
= LPat (GhcPass p) -> Bool
goL
where
goL :: LPat (GhcPass p) -> Bool
goL = LPat (GhcPass p) -> Bool
go (LPat (GhcPass p) -> Bool)
-> (LPat (GhcPass p) -> LPat (GhcPass p))
-> LPat (GhcPass p)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LPat (GhcPass p) -> LPat (GhcPass p)
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
go :: LPat (GhcPass p) -> Bool
go (WildPat {}) = Bool
True
go (VarPat {}) = Bool
True
go (LazyPat {}) = Bool
True
go (BangPat XBangPat (GhcPass p)
_ LPat (GhcPass p)
pat) = LPat (GhcPass p) -> Bool
goL LPat (GhcPass p)
pat
go (CoPat XCoPat (GhcPass p)
_ HsWrapper
_ LPat (GhcPass p)
pat Type
_) = LPat (GhcPass p) -> Bool
go LPat (GhcPass p)
pat
go (ParPat XParPat (GhcPass p)
_ LPat (GhcPass p)
pat) = LPat (GhcPass p) -> Bool
goL LPat (GhcPass p)
pat
go (AsPat XAsPat (GhcPass p)
_ Located (IdP (GhcPass p))
_ LPat (GhcPass p)
pat) = LPat (GhcPass p) -> Bool
goL LPat (GhcPass p)
pat
go (ViewPat XViewPat (GhcPass p)
_ LHsExpr (GhcPass p)
_ LPat (GhcPass p)
pat) = LPat (GhcPass p) -> Bool
goL LPat (GhcPass p)
pat
go (SigPat XSigPat (GhcPass p)
_ LPat (GhcPass p)
pat LHsSigWcType (NoGhcTc (GhcPass p))
_) = LPat (GhcPass p) -> Bool
goL LPat (GhcPass p)
pat
go (TuplePat XTuplePat (GhcPass p)
_ [LPat (GhcPass p)]
pats Boxity
_) = (LPat (GhcPass p) -> Bool) -> [LPat (GhcPass p)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all LPat (GhcPass p) -> Bool
goL [LPat (GhcPass p)]
pats
go (SumPat {}) = Bool
False
go (ListPat {}) = Bool
False
go (ConPatIn {}) = Bool
False
go (ConPatOut
{ pat_con :: forall p. Pat p -> Located ConLike
pat_con = (Located ConLike -> Located (SrcSpanLess (Located ConLike))
forall a. HasSrcSpan a => a -> Located (SrcSpanLess a)
dL->L SrcSpan
_ (RealDataCon con))
, pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args = HsConPatDetails (GhcPass p)
details })
=
Maybe DataCon -> Bool
forall a. Maybe a -> Bool
isJust (TyCon -> Maybe DataCon
tyConSingleDataCon_maybe (DataCon -> TyCon
dataConTyCon DataCon
con))
Bool -> Bool -> Bool
&& (LPat (GhcPass p) -> Bool) -> [LPat (GhcPass p)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all LPat (GhcPass p) -> Bool
goL (HsConPatDetails (GhcPass p) -> [LPat (GhcPass p)]
forall p. HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails (GhcPass p)
details)
go (ConPatOut
{ pat_con :: forall p. Pat p -> Located ConLike
pat_con = (Located ConLike -> Located (SrcSpanLess (Located ConLike))
forall a. HasSrcSpan a => a -> Located (SrcSpanLess a)
dL->L SrcSpan
_ (PatSynCon _pat)) })
= Bool
False
go (ConPatOut{}) = String -> Bool
forall a. String -> a
panic String
"ConPatOut:Impossible Match"
go (LitPat {}) = Bool
False
go (NPat {}) = Bool
False
go (NPlusKPat {}) = Bool
False
go (SplicePat {}) = Bool
False
go (XPat {}) = Bool
False
patNeedsParens :: PprPrec -> Pat p -> Bool
patNeedsParens :: PprPrec -> Pat p -> Bool
patNeedsParens PprPrec
p = Pat p -> Bool
go
where
go :: Pat p -> Bool
go (NPlusKPat {}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
> PprPrec
opPrec
go (SplicePat {}) = Bool
False
go (ConPatIn Located (IdP p)
_ HsConPatDetails p
ds) = PprPrec -> HsConPatDetails p -> Bool
forall a b. PprPrec -> HsConDetails a b -> Bool
conPatNeedsParens PprPrec
p HsConPatDetails p
ds
go cp :: Pat p
cp@(ConPatOut {}) = PprPrec -> HsConPatDetails p -> Bool
forall a b. PprPrec -> HsConDetails a b -> Bool
conPatNeedsParens PprPrec
p (Pat p -> HsConPatDetails p
forall p. Pat p -> HsConPatDetails p
pat_args Pat p
cp)
go (SigPat {}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
sigPrec
go (ViewPat {}) = Bool
True
go (CoPat XCoPat p
_ HsWrapper
_ Pat p
p Type
_) = Pat p -> Bool
go Pat p
p
go (WildPat {}) = Bool
False
go (VarPat {}) = Bool
False
go (LazyPat {}) = Bool
False
go (BangPat {}) = Bool
False
go (ParPat {}) = Bool
False
go (AsPat {}) = Bool
False
go (TuplePat {}) = Bool
False
go (SumPat {}) = Bool
False
go (ListPat {}) = Bool
False
go (LitPat XLitPat p
_ HsLit p
l) = PprPrec -> HsLit p -> Bool
forall x. PprPrec -> HsLit x -> Bool
hsLitNeedsParens PprPrec
p HsLit p
l
go (NPat XNPat p
_ Located (HsOverLit p)
lol Maybe (SyntaxExpr p)
_ SyntaxExpr p
_) = PprPrec -> HsOverLit p -> Bool
forall x. PprPrec -> HsOverLit x -> Bool
hsOverLitNeedsParens PprPrec
p (Located (HsOverLit p) -> SrcSpanLess (Located (HsOverLit p))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc Located (HsOverLit p)
lol)
go (XPat {}) = Bool
True
conPatNeedsParens :: PprPrec -> HsConDetails a b -> Bool
conPatNeedsParens :: PprPrec -> HsConDetails a b -> Bool
conPatNeedsParens PprPrec
p = HsConDetails a b -> Bool
go
where
go :: HsConDetails a b -> Bool
go (PrefixCon [a]
args) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
appPrec Bool -> Bool -> Bool
&& Bool -> Bool
not ([a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [a]
args)
go (InfixCon {}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
opPrec
go (RecCon {}) = Bool
False
parenthesizePat :: PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat :: PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
p lpat :: LPat (GhcPass p)
lpat@(LPat (GhcPass p) -> Located (SrcSpanLess (LPat (GhcPass p)))
forall a. HasSrcSpan a => a -> Located (SrcSpanLess a)
dL->L SrcSpan
loc SrcSpanLess (LPat (GhcPass p))
pat)
| PprPrec -> LPat (GhcPass p) -> Bool
forall p. PprPrec -> Pat p -> Bool
patNeedsParens PprPrec
p SrcSpanLess (LPat (GhcPass p))
LPat (GhcPass p)
pat = SrcSpan -> SrcSpanLess (LPat (GhcPass p)) -> LPat (GhcPass p)
forall a. HasSrcSpan a => SrcSpan -> SrcSpanLess a -> a
cL SrcSpan
loc (XParPat (GhcPass p) -> LPat (GhcPass p) -> LPat (GhcPass p)
forall p. XParPat p -> Pat p -> Pat p
ParPat XParPat (GhcPass p)
NoExt
NoExt LPat (GhcPass p)
lpat)
| Bool
otherwise = LPat (GhcPass p)
lpat
collectEvVarsPats :: [Pat GhcTc] -> Bag EvVar
collectEvVarsPats :: [Pat GhcTc] -> Bag TyVar
collectEvVarsPats = [Bag TyVar] -> Bag TyVar
forall a. [Bag a] -> Bag a
unionManyBags ([Bag TyVar] -> Bag TyVar)
-> ([Pat GhcTc] -> [Bag TyVar]) -> [Pat GhcTc] -> Bag TyVar
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pat GhcTc -> Bag TyVar) -> [Pat GhcTc] -> [Bag TyVar]
forall a b. (a -> b) -> [a] -> [b]
map Pat GhcTc -> Bag TyVar
collectEvVarsPat
collectEvVarsLPat :: LPat GhcTc -> Bag EvVar
collectEvVarsLPat :: Pat GhcTc -> Bag TyVar
collectEvVarsLPat = Pat GhcTc -> Bag TyVar
collectEvVarsPat (Pat GhcTc -> Bag TyVar)
-> (Pat GhcTc -> Pat GhcTc) -> Pat GhcTc -> Bag TyVar
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pat GhcTc -> Pat GhcTc
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
collectEvVarsPat :: Pat GhcTc -> Bag EvVar
collectEvVarsPat :: Pat GhcTc -> Bag TyVar
collectEvVarsPat Pat GhcTc
pat =
case Pat GhcTc
pat of
LazyPat XLazyPat GhcTc
_ Pat GhcTc
p -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
AsPat XAsPat GhcTc
_ Located (IdP GhcTc)
_ Pat GhcTc
p -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
ParPat XParPat GhcTc
_ Pat GhcTc
p -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
BangPat XBangPat GhcTc
_ Pat GhcTc
p -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
ListPat XListPat GhcTc
_ [Pat GhcTc]
ps -> [Bag TyVar] -> Bag TyVar
forall a. [Bag a] -> Bag a
unionManyBags ([Bag TyVar] -> Bag TyVar) -> [Bag TyVar] -> Bag TyVar
forall a b. (a -> b) -> a -> b
$ (Pat GhcTc -> Bag TyVar) -> [Pat GhcTc] -> [Bag TyVar]
forall a b. (a -> b) -> [a] -> [b]
map Pat GhcTc -> Bag TyVar
collectEvVarsLPat [Pat GhcTc]
ps
TuplePat XTuplePat GhcTc
_ [Pat GhcTc]
ps Boxity
_ -> [Bag TyVar] -> Bag TyVar
forall a. [Bag a] -> Bag a
unionManyBags ([Bag TyVar] -> Bag TyVar) -> [Bag TyVar] -> Bag TyVar
forall a b. (a -> b) -> a -> b
$ (Pat GhcTc -> Bag TyVar) -> [Pat GhcTc] -> [Bag TyVar]
forall a b. (a -> b) -> [a] -> [b]
map Pat GhcTc -> Bag TyVar
collectEvVarsLPat [Pat GhcTc]
ps
SumPat XSumPat GhcTc
_ Pat GhcTc
p Int
_ Int
_ -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
ConPatOut {pat_dicts :: forall p. Pat p -> [TyVar]
pat_dicts = [TyVar]
dicts, pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args = HsConPatDetails GhcTc
args}
-> Bag TyVar -> Bag TyVar -> Bag TyVar
forall a. Bag a -> Bag a -> Bag a
unionBags ([TyVar] -> Bag TyVar
forall a. [a] -> Bag a
listToBag [TyVar]
dicts)
(Bag TyVar -> Bag TyVar) -> Bag TyVar -> Bag TyVar
forall a b. (a -> b) -> a -> b
$ [Bag TyVar] -> Bag TyVar
forall a. [Bag a] -> Bag a
unionManyBags
([Bag TyVar] -> Bag TyVar) -> [Bag TyVar] -> Bag TyVar
forall a b. (a -> b) -> a -> b
$ (Pat GhcTc -> Bag TyVar) -> [Pat GhcTc] -> [Bag TyVar]
forall a b. (a -> b) -> [a] -> [b]
map Pat GhcTc -> Bag TyVar
collectEvVarsLPat
([Pat GhcTc] -> [Bag TyVar]) -> [Pat GhcTc] -> [Bag TyVar]
forall a b. (a -> b) -> a -> b
$ HsConPatDetails GhcTc -> [Pat GhcTc]
forall p. HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails GhcTc
args
SigPat XSigPat GhcTc
_ Pat GhcTc
p LHsSigWcType (NoGhcTc GhcTc)
_ -> Pat GhcTc -> Bag TyVar
collectEvVarsLPat Pat GhcTc
p
CoPat XCoPat GhcTc
_ HsWrapper
_ Pat GhcTc
p Type
_ -> Pat GhcTc -> Bag TyVar
collectEvVarsPat Pat GhcTc
p
ConPatIn Located (IdP GhcTc)
_ HsConPatDetails GhcTc
_ -> String -> Bag TyVar
forall a. String -> a
panic String
"foldMapPatBag: ConPatIn"
Pat GhcTc
_other_pat -> Bag TyVar
forall a. Bag a
emptyBag