Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Split tree for transforming pattern clauses into case trees.
The coverage checker generates a split tree from the clauses. The clause compiler uses it to transform clauses to case trees.
The initial problem is a set of clauses. The root node designates on which argument to split and has subtrees for all the constructors. Splitting continues until there is only a single clause left at each leaf of the split tree.
Synopsis
- type SplitTree = SplitTree' SplitTag
- type SplitTrees = SplitTrees' SplitTag
- data SplitTree' a
- = SplittingDone {
- splitBindings :: Int
- | SplitAt {
- splitArg :: Arg Int
- splitLazy :: LazySplit
- splitTrees :: SplitTrees' a
- = SplittingDone {
- data LazySplit
- type SplitTrees' a = [(a, SplitTree' a)]
- data SplitTag
- data SplitTreeLabel a = SplitTreeLabel {
- lblConstructorName :: Maybe a
- lblSplitArg :: Maybe (Arg Int)
- lblLazy :: LazySplit
- lblBindings :: Maybe Int
- toTree :: SplitTree' a -> Tree (SplitTreeLabel a)
- toTrees :: SplitTrees' a -> Forest (SplitTreeLabel a)
Documentation
type SplitTree = SplitTree' SplitTag Source #
type SplitTrees = SplitTrees' SplitTag Source #
data SplitTree' a Source #
Abstract case tree shape.
SplittingDone | No more splits coming. We are at a single, all-variable clause. |
| |
SplitAt | A split is necessary. |
|
Instances
DropArgs SplitTree Source # | |
Pretty a => Pretty (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree pretty :: SplitTree' a -> Doc Source # prettyPrec :: Int -> SplitTree' a -> Doc Source # prettyList :: [SplitTree' a] -> Doc Source # | |
KillRange a => KillRange (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree killRange :: KillRangeT (SplitTree' a) Source # | |
EmbPrj a => EmbPrj (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Serialise.Instances.Internal icode :: SplitTree' a -> S Int32 Source # icod_ :: SplitTree' a -> S Int32 Source # value :: Int32 -> R (SplitTree' a) Source # | |
Generic (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree type Rep (SplitTree' a) :: Type -> Type from :: SplitTree' a -> Rep (SplitTree' a) x to :: Rep (SplitTree' a) x -> SplitTree' a | |
Show a => Show (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree showsPrec :: Int -> SplitTree' a -> ShowS show :: SplitTree' a -> String showList :: [SplitTree' a] -> ShowS | |
NFData a => NFData (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree rnf :: SplitTree' a -> () | |
type Rep (SplitTree' a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree type Rep (SplitTree' a) = D1 ('MetaData "SplitTree'" "Agda.TypeChecking.Coverage.SplitTree" "Agda-2.6.3.20230930-inplace" 'False) (C1 ('MetaCons "SplittingDone" 'PrefixI 'True) (S1 ('MetaSel ('Just "splitBindings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "SplitAt" 'PrefixI 'True) (S1 ('MetaSel ('Just "splitArg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Arg Int)) :*: (S1 ('MetaSel ('Just "splitLazy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LazySplit) :*: S1 ('MetaSel ('Just "splitTrees") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SplitTrees' a))))) |
Instances
EmbPrj LazySplit Source # | |
Generic LazySplit Source # | |
Show LazySplit Source # | |
NFData LazySplit Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree | |
Eq LazySplit Source # | |
Ord LazySplit Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree | |
type Rep LazySplit Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree type Rep LazySplit = D1 ('MetaData "LazySplit" "Agda.TypeChecking.Coverage.SplitTree" "Agda-2.6.3.20230930-inplace" 'False) (C1 ('MetaCons "LazySplit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StrictSplit" 'PrefixI 'False) (U1 :: Type -> Type)) |
type SplitTrees' a = [(a, SplitTree' a)] Source #
Split tree branching. A finite map from constructor names to splittrees A list representation seems appropriate, since we are expecting not so many constructors per data type, and there is no need for random access.
Tag for labeling branches of a split tree. Each branch is associated to either a constructor or a literal, or is a catchall branch (currently only used for splitting on a literal type).
Instances
Pretty SplitTag Source # | |
KillRange SplitTag Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree | |
DropArgs SplitTree Source # | |
PrettyTCM SplitTag Source # | |
Defined in Agda.TypeChecking.Pretty | |
EmbPrj SplitTag Source # | |
Generic SplitTag Source # | |
Show SplitTag Source # | |
NFData SplitTag Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree | |
Eq SplitTag Source # | |
Ord SplitTag Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree | |
type Rep SplitTag Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree type Rep SplitTag = D1 ('MetaData "SplitTag" "Agda.TypeChecking.Coverage.SplitTree" "Agda-2.6.3.20230930-inplace" 'False) (C1 ('MetaCons "SplitCon" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName)) :+: (C1 ('MetaCons "SplitLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Literal)) :+: C1 ('MetaCons "SplitCatchall" 'PrefixI 'False) (U1 :: Type -> Type))) |
Printing a split tree
data SplitTreeLabel a Source #
SplitTreeLabel | |
|
Instances
Pretty a => Pretty (SplitTreeLabel a) Source # | |
Defined in Agda.TypeChecking.Coverage.SplitTree pretty :: SplitTreeLabel a -> Doc Source # prettyPrec :: Int -> SplitTreeLabel a -> Doc Source # prettyList :: [SplitTreeLabel a] -> Doc Source # |
toTree :: SplitTree' a -> Tree (SplitTreeLabel a) Source #
Convert a split tree into a Tree
(for printing).
toTrees :: SplitTrees' a -> Forest (SplitTreeLabel a) Source #