syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellSafe
LanguageHaskell2010

AST.Class.Nodes

Description

A class for lifting constraints to child nodes of a Knot.

Synopsis

Documentation

class KNodes (k :: Knot -> Type) where Source #

KNodes allows lifting a constraint to the child nodes of a Knot by using the KNodesConstraint type family.

It also provides some methods to combine and process child node constraints.

Various classes like KFunctor build upon KNodes to provide methods such as mapKWith which provide a rank-n function for processing child nodes which requires a constraint on the nodes.

Associated Types

type KNodesConstraint k (c :: (Knot -> Type) -> Constraint) :: Constraint Source #

Lift a constraint to apply to the child nodes

data KWitness k :: (Knot -> Type) -> Type Source #

KWitness k n is a witness that n is a node of k

Methods

kLiftConstraint :: KNodesConstraint k c => KWitness k n -> Proxy c -> (c n => r) -> r Source #

Lift a rank-n value with a constraint which the child nodes satisfy to a function from a node witness.

Instances
KNodes Pure Source # 
Instance details

Defined in AST.Knot.Pure

Associated Types

type KNodesConstraint Pure c :: Constraint Source #

data KWitness Pure a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint Pure c => KWitness Pure n -> Proxy c -> (c n -> r) -> r Source #

KNodes Prune Source # 
Instance details

Defined in AST.Knot.Prune

Associated Types

type KNodesConstraint Prune c :: Constraint Source #

data KWitness Prune a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint Prune c => KWitness Prune n -> Proxy c -> (c n -> r) -> r Source #

KNodes (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Associated Types

type KNodesConstraint (ANode c) c :: Constraint Source #

data KWitness (ANode c) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (ANode c) c0 => KWitness (ANode c) n -> Proxy c0 -> (c0 n -> r) -> r Source #

KNodes (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Associated Types

type KNodesConstraint (F f) c :: Constraint Source #

data KWitness (F f) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (F f) c => KWitness (F f) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Associated Types

type KNodesConstraint (Ann a) c :: Constraint Source #

data KWitness (Ann a) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Ann a) c => KWitness (Ann a) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Unify.Error

Associated Types

type KNodesConstraint (UnifyError t) c :: Constraint Source #

data KWitness (UnifyError t) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (UnifyError t) c => KWitness (UnifyError t) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Associated Types

type KNodesConstraint (FuncType typ) c :: Constraint Source #

data KWitness (FuncType typ) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (FuncType typ) c => KWitness (FuncType typ) n -> Proxy c -> (c n -> r) -> r Source #

(RNodes t, KNodes (NomVarTypes t)) => KNodes (LoadedNominalDecl t) Source # 
Instance details

Defined in AST.Term.Nominal

KNodes (NominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

Associated Types

type KNodesConstraint (NominalDecl typ) c :: Constraint Source #

data KWitness (NominalDecl typ) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (NominalDecl typ) c => KWitness (NominalDecl typ) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (App expr) Source # 
Instance details

Defined in AST.Term.App

Associated Types

type KNodesConstraint (App expr) c :: Constraint Source #

data KWitness (App expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (App expr) c => KWitness (App expr) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Associated Types

type KNodesConstraint (ScopeTypes t) c :: Constraint Source #

data KWitness (ScopeTypes t) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (ScopeTypes t) c => KWitness (ScopeTypes t) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Class.Nodes

Associated Types

type KNodesConstraint (Const a) c :: Constraint Source #

data KWitness (Const a) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Const a) c => KWitness (Const a) n -> Proxy c -> (c n -> r) -> r Source #

RNodes a => KNodes (Flip GTerm a) Source # 
Instance details

Defined in AST.Unify.Generalize

Associated Types

type KNodesConstraint (Flip GTerm a) c :: Constraint Source #

data KWitness (Flip GTerm a) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Flip GTerm a) c => KWitness (Flip GTerm a) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Flip (ITerm a) e) Source # 
Instance details

Defined in AST.Infer.Term

Associated Types

type KNodesConstraint (Flip (ITerm a) e) c :: Constraint Source #

data KWitness (Flip (ITerm a) e) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Flip (ITerm a) e) c => KWitness (Flip (ITerm a) e) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Flip (BTerm a) e) Source # 
Instance details

Defined in AST.Infer.Blame

Associated Types

type KNodesConstraint (Flip (BTerm a) e) c :: Constraint Source #

data KWitness (Flip (BTerm a) e) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Flip (BTerm a) e) c => KWitness (Flip (BTerm a) e) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Combinator.Compose

Associated Types

type KNodesConstraint (Compose a b) c :: Constraint Source #

data KWitness (Compose a b) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Compose a b) c => KWitness (Compose a b) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Associated Types

type KNodesConstraint (TermMap k expr) c :: Constraint Source #

data KWitness (TermMap k expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (TermMap k expr) c => KWitness (TermMap k expr) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Associated Types

type KNodesConstraint (Var v expr) c :: Constraint Source #

data KWitness (Var v expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Var v expr) c => KWitness (Var v expr) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Associated Types

type KNodesConstraint (Scheme varTypes typ) c :: Constraint Source #

data KWitness (Scheme varTypes typ) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Scheme varTypes typ) c => KWitness (Scheme varTypes typ) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Associated Types

type KNodesConstraint (TypeSig vars term) c :: Constraint Source #

data KWitness (TypeSig vars term) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (TypeSig vars term) c => KWitness (TypeSig vars term) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Associated Types

type KNodesConstraint (FromNom nomId term) c :: Constraint Source #

data KWitness (FromNom nomId term) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (FromNom nomId term) c => KWitness (FromNom nomId term) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Associated Types

type KNodesConstraint (ToNom nomId term) c :: Constraint Source #

data KWitness (ToNom nomId term) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (ToNom nomId term) c => KWitness (ToNom nomId term) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Term.Nominal

Associated Types

type KNodesConstraint (NominalInst n v) c :: Constraint Source #

data KWitness (NominalInst n v) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (NominalInst n v) c => KWitness (NominalInst n v) n0 -> Proxy c -> (c n0 -> r) -> r Source #

KNodes (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Associated Types

type KNodesConstraint (Let v expr) c :: Constraint Source #

data KWitness (Let v expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Let v expr) c => KWitness (Let v expr) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Associated Types

type KNodesConstraint (Lam v expr) c :: Constraint Source #

data KWitness (Lam v expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Lam v expr) c => KWitness (Lam v expr) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Associated Types

type KNodesConstraint (Scope expr a) c :: Constraint Source #

data KWitness (Scope expr a) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Scope expr a) c => KWitness (Scope expr a) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Associated Types

type KNodesConstraint (ScopeVar expr a) c :: Constraint Source #

data KWitness (ScopeVar expr a) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (ScopeVar expr a) c => KWitness (ScopeVar expr a) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Class.Nodes

Associated Types

type KNodesConstraint (Product a b) c :: Constraint Source #

data KWitness (Product a b) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Product a b) c => KWitness (Product a b) n -> Proxy c -> (c n -> r) -> r Source #

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

Defined in AST.Class.Nodes

Associated Types

type KNodesConstraint (Sum a b) c :: Constraint Source #

data KWitness (Sum a b) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (Sum a b) c => KWitness (Sum a b) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Associated Types

type KNodesConstraint (FlatRowExtends key val rest) c :: Constraint Source #

data KWitness (FlatRowExtends key val rest) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (FlatRowExtends key val rest) c => KWitness (FlatRowExtends key val rest) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Associated Types

type KNodesConstraint (RowExtend key val rest) c :: Constraint Source #

data KWitness (RowExtend key val rest) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (RowExtend key val rest) c => KWitness (RowExtend key val rest) n -> Proxy c -> (c n -> r) -> r Source #

KNodes (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Associated Types

type KNodesConstraint (TypedLam var typ expr) c :: Constraint Source #

data KWitness (TypedLam var typ expr) a :: Type Source #

Methods

kLiftConstraint :: KNodesConstraint (TypedLam var typ expr) c => KWitness (TypedLam var typ expr) n -> Proxy c -> (c n -> r) -> r Source #

(#>) :: (KNodes k, KNodesConstraint k c) => Proxy c -> (c n => r) -> KWitness k n -> r infixr 0 Source #

Proxy c #> r replaces the witness parameter of r@ with a constraint on the witnessed node

(#*#) :: (KNodes k, KNodesConstraint k c) => Proxy c -> (KWitness k n -> c n => r) -> KWitness k n -> r infixr 0 Source #

A variant of #> which does not consume the witness parameter.

Proxy c0 Proxy c1 #> r brings into context both the c0 n and c1 n constraints.