Safe Haskell | None |
---|---|
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
Functor WithArity Source # | |
Foldable WithArity Source # | |
Defined in Agda.TypeChecking.CompiledClause fold :: Monoid m => WithArity m -> m # foldMap :: Monoid m => (a -> m) -> WithArity a -> m # foldMap' :: Monoid m => (a -> m) -> WithArity a -> m # foldr :: (a -> b -> b) -> b -> WithArity a -> b # foldr' :: (a -> b -> b) -> b -> WithArity a -> b # foldl :: (b -> a -> b) -> b -> WithArity a -> b # foldl' :: (b -> a -> b) -> b -> WithArity a -> b # foldr1 :: (a -> a -> a) -> WithArity a -> a # foldl1 :: (a -> a -> a) -> WithArity a -> a # toList :: WithArity a -> [a] # length :: WithArity a -> Int # elem :: Eq a => a -> WithArity a -> Bool # maximum :: Ord a => WithArity a -> a # minimum :: Ord a => WithArity a -> a # | |
Traversable WithArity Source # | |
Defined in Agda.TypeChecking.CompiledClause | |
Data c => Data (WithArity c) Source # | |
Defined in Agda.TypeChecking.CompiledClause gfoldl :: (forall d b. Data d => c0 (d -> b) -> d -> c0 b) -> (forall g. g -> c0 g) -> WithArity c -> c0 (WithArity c) # gunfold :: (forall b r. Data b => c0 (b -> r) -> c0 r) -> (forall r. r -> c0 r) -> Constr -> c0 (WithArity c) # toConstr :: WithArity c -> Constr # dataTypeOf :: WithArity c -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c0 (t d)) -> Maybe (c0 (WithArity c)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c0 (t d e)) -> Maybe (c0 (WithArity c)) # gmapT :: (forall b. Data b => b -> b) -> WithArity c -> WithArity c # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WithArity c -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WithArity c -> r # gmapQ :: (forall d. Data d => d -> u) -> WithArity c -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WithArity c -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WithArity c -> m (WithArity c) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WithArity c -> m (WithArity c) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WithArity c -> m (WithArity c) # | |
Show c => Show (WithArity c) Source # | |
Semigroup c => Semigroup (WithArity c) Source # | |
(Semigroup c, Monoid c) => Monoid (WithArity c) Source # | |
Pretty a => Pretty (WithArity a) Source # | |
KillRange c => KillRange (WithArity c) Source # | |
Defined in Agda.TypeChecking.CompiledClause killRange :: KillRangeT (WithArity c) Source # | |
Abstract a => Abstract (WithArity a) Source # | |
Apply a => Apply (WithArity a) Source # | |
TermLike a => TermLike (WithArity a) Source # | |
EmbPrj a => EmbPrj (WithArity a) Source # | |
NamesIn a => NamesIn (WithArity a) Source # | |
InstantiateFull t => InstantiateFull (WithArity t) Source # | |
Defined in Agda.TypeChecking.Reduce |
Branches in a case tree.
Branches | |
|
Instances
Functor Case Source # | |
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 # | |
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) # | |
Show c => Show (Case c) Source # | |
Semigroup m => Semigroup (Case m) Source # | |
(Semigroup m, Monoid m) => Monoid (Case m) Source # | |
Null (Case m) Source # | |
Pretty a => Pretty (Case a) Source # | |
KillRange c => KillRange (Case c) Source # | |
Defined in Agda.TypeChecking.CompiledClause killRange :: KillRangeT (Case c) Source # | |
Abstract a => Abstract (Case a) Source # | |
Apply a => Apply (Case a) Source # | |
TermLike a => TermLike (Case a) Source # | |
EmbPrj a => EmbPrj (Case a) Source # | |
NamesIn a => NamesIn (Case a) Source # | |
InstantiateFull a => InstantiateFull (Case a) Source # | |
Defined in Agda.TypeChecking.Reduce |
data CompiledClauses' a Source #
Case tree with bodies.
Case (Arg Int) (Case (CompiledClauses' a)) |
|
Done [Arg ArgName] a |
|
Fail | Absurd case. |
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