cubix
Safe HaskellNone
LanguageHaskell2010

Cubix.Language.Parametric.ProgInfo

Synopsis

Type

data ProgInfo (fs :: Signature) Source #

Instances

Instances details
HasProgInfo (ProgInfo fs) fs Source # 
Instance details

Defined in Cubix.Language.Parametric.ProgInfo

Methods

progInfo :: Lens' (ProgInfo fs) (ProgInfo fs) Source #

proginf_cfg :: Lens' (ProgInfo fs) (Cfg fs) Source #

proginf_paths :: Lens' (ProgInfo fs) (Map Label Path) Source #

proginf_program :: Lens' (ProgInfo fs) (E (TermLab fs)) Source #

class HasProgInfo c (fs :: Signature) | c -> fs where Source #

Minimal complete definition

progInfo

Methods

progInfo :: Lens' c (ProgInfo fs) Source #

proginf_cfg :: Lens' c (Cfg fs) Source #

proginf_paths :: Lens' c (Map Label Path) Source #

proginf_program :: Lens' c (E (TermLab fs)) Source #

Instances

Instances details
HasProgInfo (ProgInfo fs) fs Source # 
Instance details

Defined in Cubix.Language.Parametric.ProgInfo

Methods

progInfo :: Lens' (ProgInfo fs) (ProgInfo fs) Source #

proginf_cfg :: Lens' (ProgInfo fs) (Cfg fs) Source #

proginf_paths :: Lens' (ProgInfo fs) (Map Label Path) Source #

proginf_program :: Lens' (ProgInfo fs) (E (TermLab fs)) Source #

Construction

makeProgInfo :: forall (fs :: Signature) l. (CfgBuilder fs, All HFoldable fs) => TermLab fs l -> ProgInfo fs Source #

Accessors

cfgNodePath :: forall (fs :: Signature). ProgInfo fs -> CfgNode fs -> Maybe Path Source #

labToPath :: forall (fs :: Signature). Label -> ProgInfo fs -> Path Source #

termToPath :: forall (fs :: Signature) l. ProgInfo fs -> TermLab fs l -> Path Source #

Utilities involving multiple components

containingCfgNode :: forall (fs :: [(Type -> Type) -> Type -> Type]) l. (All HTraversable fs, All HFoldable fs, All HFunctor fs) => ProgInfo fs -> TermLab fs l -> Maybe (E (TermLab fs)) Source #

Let prog be the overall program, t be a subterm, and progInfo the ProgInfo for prog. Then containingCfgNode progInf t returns the smallest ancestor of t which has a corresponding node in the CFG, or Nothing if no such node exists.

This is useful for writing code which deals with generic nodes such as Ident which are contained in computation nodes, but are not themselves computation nodes.

withContainingCfgNode :: forall (fs :: [(Type -> Type) -> Type -> Type]) m l. (All HTraversable fs, All HFoldable fs, All HFunctor fs, Applicative m) => ProgInfo fs -> TermLab fs l -> (forall i. TermLab fs i -> m ()) -> m () Source #

See documentation of containingCfgNode. Runs the passed function on the result of containingCfgNode, if the result is not Nothing.