macaw-base
Safe HaskellNone
LanguageHaskell2010

Data.Macaw.Fold

Synopsis

Documentation

class FoldableFC (t :: (k -> Type) -> l -> Type) where #

Minimal complete definition

foldMapFC | foldrFC

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

Instances details
FoldableFC App Source # 
Instance details

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 # 
Instance details

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) 
Instance details

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) 
Instance details

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) 
Instance details

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.