syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellNone
LanguageHaskell2010

AST.Knot.Ann

Description

A Knot which adds an annotation to every node in a tree

Synopsis

Documentation

data Ann a k Source #

A Knot which adds an annotation to every node in a tree

Constructors

Ann 

Fields

Instances
c (Ann a) => Recursively c (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

recursively :: Proxy (c (Ann a)) -> Dict (c (Ann a), KNodesConstraint (Ann a) (Recursively c)) 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 #

Monoid a => KPointed (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

pureK :: (forall (n :: Knot -> Type). KWitness (Ann a) n -> Tree p n) -> Tree (Ann a) p 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 #

Semigroup a => KApply (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

zipK :: Tree (Ann a) p -> Tree (Ann a) q -> Tree (Ann a) (Product p q) Source #

KFoldable (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

foldMapK :: Monoid a0 => (forall (n :: Knot -> Type). KWitness (Ann a) n -> Tree p n -> a0) -> Tree (Ann a) p -> a0 Source #

KTraversable (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

sequenceK :: Applicative f => Tree (Ann a) (ContainedK f p) -> f (Tree (Ann a) p) Source #

Eq a => ZipMatch (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

zipMatch :: Tree (Ann a) p -> Tree (Ann a) q -> Maybe (Tree (Ann a) (Product p q)) Source #

RTraversable (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

RNodes (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Monoid a => KMonad (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

joinK :: Recursively KFunctor p => Tree (Compose (Ann a) (Ann a)) p -> Tree (Ann a) p Source #

Constraints (Ann a k) Eq => Eq (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

(==) :: Ann a k -> Ann a k -> Bool #

(/=) :: Ann a k -> Ann a k -> Bool #

Constraints (Ann a k) Ord => Ord (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

compare :: Ann a k -> Ann a k -> Ordering #

(<) :: Ann a k -> Ann a k -> Bool #

(<=) :: Ann a k -> Ann a k -> Bool #

(>) :: Ann a k -> Ann a k -> Bool #

(>=) :: Ann a k -> Ann a k -> Bool #

max :: Ann a k -> Ann a k -> Ann a k #

min :: Ann a k -> Ann a k -> Ann a k #

Constraints (Ann a k) Show => Show (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

showsPrec :: Int -> Ann a k -> ShowS #

show :: Ann a k -> String #

showList :: [Ann a k] -> ShowS #

Generic (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Associated Types

type Rep (Ann a k) :: Type -> Type #

Methods

from :: Ann a k -> Rep (Ann a k) x #

to :: Rep (Ann a k) x -> Ann a k #

(Arbitrary a, Arbitrary (k # Ann a)) => Arbitrary (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann.Arbitrary

Methods

arbitrary :: Gen (Ann a k) #

shrink :: Ann a k -> [Ann a k] #

Constraints (Ann a k) Binary => Binary (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

put :: Ann a k -> Put #

get :: Get (Ann a k) #

putList :: [Ann a k] -> Put #

Constraints (Ann a k) NFData => NFData (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

rnf :: Ann a k -> () #

Constraints (Ann a t) Pretty => Pretty (Ann a t) Source # 
Instance details

Defined in AST.Knot.Ann

Methods

pPrintPrec :: PrettyLevel -> Rational -> Ann a t -> Doc #

pPrint :: Ann a t -> Doc #

pPrintList :: PrettyLevel -> [Ann a t] -> Doc #

(Arbitrary a, ArbitraryWithContext (k # Ann a)) => ArbitraryWithContext (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann.Arbitrary

Associated Types

type Context (Ann a k) :: Type Source #

Methods

arbitraryCtx :: Context (Ann a k) -> Gen (Ann a k) Source #

data KWitness (Ann a) node Source # 
Instance details

Defined in AST.Knot.Ann

data KWitness (Ann a) node where
type KNodesConstraint (Ann a) constraint Source # 
Instance details

Defined in AST.Knot.Ann

type KNodesConstraint (Ann a) constraint = constraint (Ann a)
type Rep (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann

type Rep (Ann a k) = D1 (MetaData "Ann" "AST.Knot.Ann" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "Ann" PrefixI True) (S1 (MetaSel (Just "_ann") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Just "_val") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (k # Ann a))))
type Context (Ann a k) Source # 
Instance details

Defined in AST.Knot.Ann.Arbitrary

type Context (Ann a k) = Context (k # Ann a)

ann :: forall a k. Lens' (Ann a k) a Source #

val :: forall a k k. Lens (Ann a k) (Ann a k) ((#) k (Ann a)) ((#) k (Ann a)) Source #

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

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

Instances
data KWitness Pure node Source # 
Instance details

Defined in AST.Knot.Pure

data KWitness Pure node where
data KWitness Prune node Source # 
Instance details

Defined in AST.Knot.Prune

data KWitness Prune node where
data KWitness (ANode c) node Source # 
Instance details

Defined in AST.Combinator.ANode

data KWitness (ANode c) node where
data KWitness (F f) node Source # 
Instance details

Defined in AST.Knot.Functor

data KWitness (F f) node where
data KWitness (Ann a) node Source # 
Instance details

Defined in AST.Knot.Ann

data KWitness (Ann a) node where
data KWitness (UnifyError t) n Source # 
Instance details

Defined in AST.Unify.Error

data KWitness (UnifyError t) n where
data KWitness (FuncType typ) node Source # 
Instance details

Defined in AST.Term.FuncType

data KWitness (FuncType typ) node where
data KWitness (LoadedNominalDecl t) n Source # 
Instance details

Defined in AST.Term.Nominal

data KWitness (NominalDecl typ) node Source # 
Instance details

Defined in AST.Term.Nominal

data KWitness (App expr) node Source # 
Instance details

Defined in AST.Term.App

data KWitness (App expr) node where
data KWitness (ScopeTypes t) node Source # 
Instance details

Defined in AST.Term.NamelessScope

data KWitness (ScopeTypes t) node where
data KWitness (Const a :: Knot -> Type) i Source # 
Instance details

Defined in AST.Class.Nodes

data KWitness (Const a :: Knot -> Type) i
data KWitness (Flip GTerm a) n Source # 
Instance details

Defined in AST.Unify.Generalize

data KWitness (Flip (ITerm a) e) n Source # 
Instance details

Defined in AST.Infer.Term

data KWitness (Flip (ITerm a) e) n where
data KWitness (Flip (BTerm a) e) n Source # 
Instance details

Defined in AST.Infer.Blame

data KWitness (Flip (BTerm a) e) n where
data KWitness (Compose a b) n Source # 
Instance details

Defined in AST.Combinator.Compose

data KWitness (Compose a b) n where
data KWitness (TermMap k expr) node Source # 
Instance details

Defined in AST.Term.Map

data KWitness (TermMap k expr) node where
data KWitness (Var v expr) node Source # 
Instance details

Defined in AST.Term.Var

data KWitness (Var v expr) node
data KWitness (Scheme varTypes typ) node Source # 
Instance details

Defined in AST.Term.Scheme

data KWitness (Scheme varTypes typ) node where
data KWitness (TypeSig vars term) node Source # 
Instance details

Defined in AST.Term.TypeSig

data KWitness (TypeSig vars term) node where
data KWitness (FromNom nomId term) node Source # 
Instance details

Defined in AST.Term.Nominal

data KWitness (FromNom nomId term) node
data KWitness (ToNom nomId term) node Source # 
Instance details

Defined in AST.Term.Nominal

data KWitness (ToNom nomId term) node where
data KWitness (NominalInst n v) c Source # 
Instance details

Defined in AST.Term.Nominal

data KWitness (Let v expr) node Source # 
Instance details

Defined in AST.Term.Let

data KWitness (Let v expr) node where
data KWitness (Lam v expr) node Source # 
Instance details

Defined in AST.Term.Lam

data KWitness (Lam v expr) node where
data KWitness (Scope expr a) node Source # 
Instance details

Defined in AST.Term.NamelessScope

data KWitness (Scope expr a) node where
data KWitness (ScopeVar expr a) node Source # 
Instance details

Defined in AST.Term.NamelessScope

data KWitness (ScopeVar expr a) node
data KWitness (Product a b) n Source # 
Instance details

Defined in AST.Class.Nodes

data KWitness (Sum a b) n Source # 
Instance details

Defined in AST.Class.Nodes

data KWitness (Sum a b) n
data KWitness (FlatRowExtends key val rest) node Source # 
Instance details

Defined in AST.Term.Row

data KWitness (FlatRowExtends key val rest) node where
data KWitness (RowExtend key val rest) node Source # 
Instance details

Defined in AST.Term.Row

data KWitness (RowExtend key val rest) node where
data KWitness (TypedLam var typ expr) node Source # 
Instance details

Defined in AST.Term.TypedLam

data KWitness (TypedLam var typ expr) node where

annotations :: forall k a b. RTraversable k => Traversal (Tree (Ann a) k) (Tree (Ann b) k) a b Source #

A Traversal from an annotated tree to its annotations

strip :: Recursively KFunctor expr => Tree (Ann a) expr -> Tree Pure expr Source #

Remove a tree's annotations

addAnnotations :: Recursively KFunctor k => (forall n. KRecWitness k n -> Tree n (Ann a) -> a) -> Tree Pure k -> Tree (Ann a) k Source #

Compute annotations for a tree from the bottom up