syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellSafe
LanguageHaskell2010

AST.Class.Functor

Description

A variant of Functor for Knots

Synopsis

Documentation

class KNodes k => KFunctor k where Source #

A variant of Functor for Knots

Methods

mapK :: (forall n. KWitness k n -> Tree p n -> Tree q n) -> Tree k p -> Tree k q Source #

KFunctor variant of fmap

Applied a given mapping for k's nodes (trees along witnesses that they are nodes of k) to result with a new tree, potentially with a different fix-point.

Instances
KFunctor Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

mapK :: (forall (n :: Knot -> Type). KWitness Pure n -> Tree p n -> Tree q n) -> Tree Pure p -> Tree Pure q Source #

KFunctor Prune Source # 
Instance details

Defined in AST.Knot.Prune

Methods

mapK :: (forall (n :: Knot -> Type). KWitness Prune n -> Tree p n -> Tree q n) -> Tree Prune p -> Tree Prune q Source #

KFunctor (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (ANode c) n -> Tree p n -> Tree q n) -> Tree (ANode c) p -> Tree (ANode c) q Source #

Functor f => KFunctor (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (F f) n -> Tree p n -> Tree q n) -> Tree (F f) p -> Tree (F f) q Source #

KFunctor (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Ann a) n -> Tree p n -> Tree q n) -> Tree (Ann a) p -> Tree (Ann a) q Source #

KFunctor t => KFunctor (UnifyError t) Source # 
Instance details

Defined in AST.Unify.Error

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (UnifyError t) n -> Tree p n -> Tree q n) -> Tree (UnifyError t) p -> Tree (UnifyError t) q Source #

KFunctor (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (FuncType typ) n -> Tree p n -> Tree q n) -> Tree (FuncType typ) p -> Tree (FuncType typ) q Source #

(Recursively KFunctor typ, KFunctor (NomVarTypes typ)) => KFunctor (LoadedNominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (LoadedNominalDecl typ) n -> Tree p n -> Tree q n) -> Tree (LoadedNominalDecl typ) p -> Tree (LoadedNominalDecl typ) q Source #

KFunctor (NominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (NominalDecl typ) n -> Tree p n -> Tree q n) -> Tree (NominalDecl typ) p -> Tree (NominalDecl typ) q Source #

KFunctor (App expr) Source # 
Instance details

Defined in AST.Term.App

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (App expr) n -> Tree p n -> Tree q n) -> Tree (App expr) p -> Tree (App expr) q Source #

KFunctor (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (ScopeTypes t) n -> Tree p n -> Tree q n) -> Tree (ScopeTypes t) p -> Tree (ScopeTypes t) q Source #

KFunctor (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Functor

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Const a) n -> Tree p n -> Tree q n) -> Tree (Const a) p -> Tree (Const a) q Source #

Recursively KFunctor ast => KFunctor (Flip GTerm ast) Source # 
Instance details

Defined in AST.Unify.Generalize

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Flip GTerm ast) n -> Tree p n -> Tree q n) -> Tree (Flip GTerm ast) p -> Tree (Flip GTerm ast) q Source #

(Recursively KFunctor e, Recursively KFunctorInferOf e) => KFunctor (Flip (ITerm a) e) Source # 
Instance details

Defined in AST.Infer.Term

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Flip (ITerm a) e) n -> Tree p n -> Tree q n) -> Tree (Flip (ITerm a) e) p -> Tree (Flip (ITerm a) e) q Source #

(Recursively KFunctor e, Recursively KFunctorInferOf e) => KFunctor (Flip (BTerm a) e) Source # 
Instance details

Defined in AST.Infer.Blame

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Flip (BTerm a) e) n -> Tree p n -> Tree q n) -> Tree (Flip (BTerm a) e) p -> Tree (Flip (BTerm a) e) q Source #

(KFunctor a, KFunctor b) => KFunctor (Compose a b) Source # 
Instance details

Defined in AST.Combinator.Compose

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Compose a b) n -> Tree p n -> Tree q n) -> Tree (Compose a b) p -> Tree (Compose a b) q Source #

KFunctor (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (TermMap k expr) n -> Tree p n -> Tree q n) -> Tree (TermMap k expr) p -> Tree (TermMap k expr) q Source #

KFunctor (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Var v expr) n -> Tree p n -> Tree q n) -> Tree (Var v expr) p -> Tree (Var v expr) q Source #

KFunctor (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Scheme varTypes typ) n -> Tree p n -> Tree q n) -> Tree (Scheme varTypes typ) p -> Tree (Scheme varTypes typ) q Source #

KFunctor (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (TypeSig vars term) n -> Tree p n -> Tree q n) -> Tree (TypeSig vars term) p -> Tree (TypeSig vars term) q Source #

KFunctor (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (FromNom nomId term) n -> Tree p n -> Tree q n) -> Tree (FromNom nomId term) p -> Tree (FromNom nomId term) q Source #

KFunctor (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (ToNom nomId term) n -> Tree p n -> Tree q n) -> Tree (ToNom nomId term) p -> Tree (ToNom nomId term) q Source #

KFunctor v => KFunctor (NominalInst n v) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

mapK :: (forall (n0 :: Knot -> Type). KWitness (NominalInst n v) n0 -> Tree p n0 -> Tree q n0) -> Tree (NominalInst n v) p -> Tree (NominalInst n v) q Source #

KFunctor (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Let v expr) n -> Tree p n -> Tree q n) -> Tree (Let v expr) p -> Tree (Let v expr) q Source #

KFunctor (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Lam v expr) n -> Tree p n -> Tree q n) -> Tree (Lam v expr) p -> Tree (Lam v expr) q Source #

KFunctor (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Scope expr a) n -> Tree p n -> Tree q n) -> Tree (Scope expr a) p -> Tree (Scope expr a) q Source #

KFunctor (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (ScopeVar expr a) n -> Tree p n -> Tree q n) -> Tree (ScopeVar expr a) p -> Tree (ScopeVar expr a) q Source #

(KFunctor a, KFunctor b) => KFunctor (Product a b) Source # 
Instance details

Defined in AST.Class.Functor

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Product a b) n -> Tree p n -> Tree q n) -> Tree (Product a b) p -> Tree (Product a b) q Source #

(KFunctor a, KFunctor b) => KFunctor (Sum a b) Source # 
Instance details

Defined in AST.Class.Functor

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (Sum a b) n -> Tree p n -> Tree q n) -> Tree (Sum a b) p -> Tree (Sum a b) q Source #

KFunctor (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (FlatRowExtends key val rest) n -> Tree p n -> Tree q n) -> Tree (FlatRowExtends key val rest) p -> Tree (FlatRowExtends key val rest) q Source #

KFunctor (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (RowExtend key val rest) n -> Tree p n -> Tree q n) -> Tree (RowExtend key val rest) p -> Tree (RowExtend key val rest) q Source #

KFunctor (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Methods

mapK :: (forall (n :: Knot -> Type). KWitness (TypedLam var typ expr) n -> Tree p n -> Tree q n) -> Tree (TypedLam var typ expr) p -> Tree (TypedLam var typ expr) q Source #

mappedK1 :: forall k n p q. (KFunctor k, KNodesConstraint k ((~) n)) => Setter (Tree k p) (Tree k q) (Tree p n) (Tree q n) Source #

KFunctor variant of mapped for Knots with a single node type.

Avoids using RankNTypes and thus can be composed with other optics.