Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Case trees.
After coverage checking, pattern matching is translated to case trees, i.e., a tree of successive case splits on one variable at a time.
Synopsis
- data WithArity c = WithArity {}
- data Case c = Branches {
- projPatterns :: Bool
- conBranches :: Map QName (WithArity c)
- etaBranch :: Maybe (ConHead, WithArity c)
- litBranches :: Map Literal c
- catchAllBranch :: Maybe c
- fallThrough :: Maybe Bool
- lazyMatch :: Bool
- data CompiledClauses' a
- type CompiledClauses = CompiledClauses' Term
- litCase :: Literal -> c -> Case c
- conCase :: QName -> Bool -> WithArity c -> Case c
- etaCase :: ConHead -> WithArity c -> Case c
- projCase :: QName -> c -> Case c
- catchAll :: c -> Case c
- checkLazyMatch :: Case c -> Case c
- hasCatchAll :: CompiledClauses -> Bool
- hasProjectionPatterns :: CompiledClauses -> Bool
- prettyMap_ :: (Pretty k, Pretty v) => Map k v -> [Doc]
Documentation
Instances
Branches in a case tree.
Branches | |
|
Instances
Foldable Case Source # | |
Defined in Agda.TypeChecking.CompiledClause fold :: Monoid m => Case m -> m # foldMap :: Monoid m => (a -> m) -> Case a -> m # foldMap' :: Monoid m => (a -> m) -> Case a -> m # foldr :: (a -> b -> b) -> b -> Case a -> b # foldr' :: (a -> b -> b) -> b -> Case a -> b # foldl :: (b -> a -> b) -> b -> Case a -> b # foldl' :: (b -> a -> b) -> b -> Case a -> b # foldr1 :: (a -> a -> a) -> Case a -> a # foldl1 :: (a -> a -> a) -> Case a -> a # elem :: Eq a => a -> Case a -> Bool # maximum :: Ord a => Case a -> a # | |
Traversable Case Source # | |
Functor Case Source # | |
TermLike a => TermLike (Case a) Source # | |
NamesIn a => NamesIn (Case a) Source # | |
KillRange c => KillRange (Case c) Source # | |
Defined in Agda.TypeChecking.CompiledClause killRange :: KillRangeT (Case c) Source # | |
InstantiateFull a => InstantiateFull (Case a) Source # | |
Defined in Agda.TypeChecking.Reduce | |
EmbPrj a => EmbPrj (Case a) Source # | |
Abstract a => Abstract (Case a) Source # | |
Apply a => Apply (Case a) Source # | |
Null (Case m) Source # | |
Pretty a => Pretty (Case a) Source # | |
Data c => Data (Case c) Source # | |
Defined in Agda.TypeChecking.CompiledClause gfoldl :: (forall d b. Data d => c0 (d -> b) -> d -> c0 b) -> (forall g. g -> c0 g) -> Case c -> c0 (Case c) # gunfold :: (forall b r. Data b => c0 (b -> r) -> c0 r) -> (forall r. r -> c0 r) -> Constr -> c0 (Case c) # toConstr :: Case c -> Constr # dataTypeOf :: Case c -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c0 (t d)) -> Maybe (c0 (Case c)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c0 (t d e)) -> Maybe (c0 (Case c)) # gmapT :: (forall b. Data b => b -> b) -> Case c -> Case c # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Case c -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Case c -> r # gmapQ :: (forall d. Data d => d -> u) -> Case c -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Case c -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Case c -> m (Case c) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Case c -> m (Case c) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Case c -> m (Case c) # | |
(Semigroup m, Monoid m) => Monoid (Case m) Source # | |
Semigroup m => Semigroup (Case m) Source # | |
Generic (Case c) Source # | |
Show c => Show (Case c) Source # | |
NFData a => NFData (Case a) Source # | |
Defined in Agda.TypeChecking.CompiledClause | |
type Rep (Case c) Source # | |
Defined in Agda.TypeChecking.CompiledClause type Rep (Case c) = D1 ('MetaData "Case" "Agda.TypeChecking.CompiledClause" "Agda-2.6.2.1.20220320-inplace" 'False) (C1 ('MetaCons "Branches" 'PrefixI 'True) ((S1 ('MetaSel ('Just "projPatterns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "conBranches") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map QName (WithArity c))) :*: S1 ('MetaSel ('Just "etaBranch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (ConHead, WithArity c))))) :*: ((S1 ('MetaSel ('Just "litBranches") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Literal c)) :*: S1 ('MetaSel ('Just "catchAllBranch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe c))) :*: (S1 ('MetaSel ('Just "fallThrough") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "lazyMatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))) |
data CompiledClauses' a Source #
Case tree with bodies.
Case (Arg Int) (Case (CompiledClauses' a)) |
|
Done [Arg ArgName] a |
|
Fail [Arg ArgName] | Absurd case. Add the free variables here as well so we can build correct number of lambdas for strict backends. (#4280) |
Instances
type CompiledClauses = CompiledClauses' Term Source #
checkLazyMatch :: Case c -> Case c Source #
Check that the requirements on lazy matching (single inductive case) are met, and set lazy to False otherwise.
hasCatchAll :: CompiledClauses -> Bool Source #
Check whether a case tree has a catch-all clause.
hasProjectionPatterns :: CompiledClauses -> Bool Source #
Check whether a case tree has any projection patterns