Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Macaw.Fold
Synopsis
- class FoldableFC (t :: (k -> Type) -> l -> Type) where
- foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m
- foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b
- foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b
- foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b
- foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b
- toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). t f x -> [a]
- data ValueFold arch ids r = ValueFold {
- foldCValue :: !(forall (tp :: Type). CValue arch tp -> r)
- foldInput :: !(forall (utp :: Type). ArchReg arch utp -> r)
- foldAssign :: !(forall (utp :: Type). AssignId ids utp -> r -> r)
- emptyValueFold :: Monoid r => ValueFold arch ids r
- foldValueCached :: forall r arch ids (tp :: Type). (Monoid r, FoldableFC (ArchFn arch)) => ValueFold arch ids r -> Value arch ids tp -> State (Map (Some (AssignId ids)) r) r
Documentation
class FoldableFC (t :: (k -> Type) -> l -> Type) where #
Methods
foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). t f x -> m #
foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b #
foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b #
foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> t f x -> b #
foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> t f x -> b #
toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). t f x -> [a] #
Instances
FoldableFC App Source # | |
Defined in Data.Macaw.CFG.App Methods foldMapFC :: forall f m. Monoid m => (forall (x :: Type). f x -> m) -> forall (x :: Type). App f x -> m # foldrFC :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> App f x -> b # foldlFC :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> App f x -> b # foldrFC' :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> App f x -> b # foldlFC' :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> App f x -> b # toListFC :: (forall (x :: Type). f x -> a) -> forall (x :: Type). App f x -> [a] # | |
FoldableFC (ArchFn arch) => FoldableFC (AssignRhs arch :: (Type -> Type) -> Type -> Type) Source # | |
Defined in Data.Macaw.CFG.AssignRhs Methods foldMapFC :: forall f m. Monoid m => (forall (x :: Type). f x -> m) -> forall (x :: Type). AssignRhs arch f x -> m # foldrFC :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> AssignRhs arch f x -> b # foldlFC :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> AssignRhs arch f x -> b # foldrFC' :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> AssignRhs arch f x -> b # foldlFC' :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> AssignRhs arch f x -> b # toListFC :: (forall (x :: Type). f x -> a) -> forall (x :: Type). AssignRhs arch f x -> [a] # | |
FoldableFC (Assignment :: (k -> Type) -> Ctx k -> Type) | |
Defined in Data.Parameterized.Context.Safe Methods foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: Ctx k). Assignment f x -> m # foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # toListFC :: (forall (x :: k). f x -> a) -> forall (x :: Ctx k). Assignment f x -> [a] # | |
FoldableFC (Assignment :: (k -> Type) -> Ctx k -> Type) | |
Defined in Data.Parameterized.Context.Unsafe Methods foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: Ctx k). Assignment f x -> m # foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: Ctx k). b -> Assignment f x -> b # toListFC :: (forall (x :: k). f x -> a) -> forall (x :: Ctx k). Assignment f x -> [a] # | |
FoldableFC (List :: (k -> Type) -> [k] -> Type) | |
Defined in Data.Parameterized.List Methods foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: [k]). List f x -> m # foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: [k]). b -> List f x -> b # foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: [k]). b -> List f x -> b # foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: [k]). b -> List f x -> b # foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: [k]). b -> List f x -> b # toListFC :: (forall (x :: k). f x -> a) -> forall (x :: [k]). List f x -> [a] # |
data ValueFold arch ids r Source #
Constructors
ValueFold | |
Fields
|
emptyValueFold :: Monoid r => ValueFold arch ids r Source #
Empty value fold returns mempty for each non-recursive fold, and the
identify of foldAssign
foldValueCached :: forall r arch ids (tp :: Type). (Monoid r, FoldableFC (ArchFn arch)) => ValueFold arch ids r -> Value arch ids tp -> State (Map (Some (AssignId ids)) r) r Source #
This folds over elements of a values in a values.
It memoizes the results so that if an assignment is visited
multiple times, we only visit the children the first time it is
visited. On subsequent visits, foldAssign
will still be called,
but the children will not be revisited.
This makes the total time to visit linear with respect to the number of children, but still allows determining whether a term is shared.