syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellNone
LanguageHaskell2010

AST

Description

A convinience module which re-exports common basic functionality of `syntax-tree`

Synopsis

Documentation

type (#) k p = Tree (GetKnot k) p Source #

A type synonym to express child nodes in nested-HKDs

type Tree k p = (k (Knot p) :: Type) Source #

A type synonym to express nested-HKD structures

type family GetKnot k where ... Source #

A type-level getter for the type constructor encoded in Knot.

Notes:

  • If DataKinds supported lifting field getters this would had been replaced with the type's getter.
  • GetKnot is injective, but due to no support for constrained type families, that's not expressible at the moment.
  • Because GetKnot can't declared as bijective, uses of it may restrict inference. In those cases wrapping terms with the asTree helper assists Haskell's type inference as if Haskell knew that GetKnot was bijective.

Equations

GetKnot (Knot t) = t 

newtype Knot Source #

A Kind for nested higher-kinded data.

Constructors

Knot (Knot -> Type) 
Instances
c (Const a :: Knot -> Type) => Recursively c (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Recursive

Methods

recursively :: Proxy (c (Const a)) -> Dict (c (Const a), KNodesConstraint (Const a) (Recursively c)) Source #

(InferOf a ~ InferOf b, Infer m a, Infer m b) => Infer m (Sum a b) Source # 
Instance details

Defined in AST.Class.Infer

Methods

inferBody :: Tree (Sum a b) (InferChild m k) -> m (Tree (Sum a b) k, Tree (InferOf (Sum a b)) (UVarOf m)) Source #

inferContext :: Proxy m -> Proxy (Sum a b) -> Dict (KNodesConstraint (Sum a b) (Infer m), KNodesConstraint (InferOf (Sum a b)) (Unify m)) 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 #

Monoid a => KPointed (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Pointed

Methods

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

Semigroup a => KApply (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Apply

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

Eq a => ZipMatch (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.ZipMatch

Methods

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

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

Defined in AST.Class.Recursive

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

Defined in AST.Class.Recursive

(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 #

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

Defined in AST.Class.Pointed

Methods

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

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

Defined in AST.Class.Apply

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

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

Defined in AST.Class.ZipMatch

Methods

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

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

Defined in AST.Class.ZipMatch

Methods

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

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

Defined in AST.Class.Nodes

data KWitness (Const a :: Knot -> Type) i
type KNodesConstraint (Const a :: Knot -> Type) x Source # 
Instance details

Defined in AST.Class.Nodes

type KNodesConstraint (Const a :: Knot -> Type) x = ()
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
type InferOf (Sum a b) Source # 
Instance details

Defined in AST.Class.Infer

type InferOf (Sum a b) = InferOf a
type KNodesConstraint (Product a b) x Source # 
Instance details

Defined in AST.Class.Nodes

type KNodesConstraint (Sum a b) x Source # 
Instance details

Defined in AST.Class.Nodes

asTree :: Tree k p -> Tree k p Source #

An id variant which tells the type checker that its argument is a Tree.

See the notes for GetKnot which expand on why this might be used.

Note that asTree may often be used during development to assist the inference of incomplete code, but removed once the code is complete.

data Product f g a Source #

A PolyKinds variant of Product.

Note that the original Product is poly-kinded in its type, but not in its instances such as Eq.

Constructors

Pair (f a) (g a) 
Instances
Generic1 (Product f g :: k -> Type) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Associated Types

type Rep1 (Product f g) :: k -> Type #

Methods

from1 :: Product f g a -> Rep1 (Product f g) a #

to1 :: Rep1 (Product f g) a -> Product f g a #

(Monad f, Monad g) => Monad (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

(>>=) :: Product f g a -> (a -> Product f g b) -> Product f g b #

(>>) :: Product f g a -> Product f g b -> Product f g b #

return :: a -> Product f g a #

fail :: String -> Product f g a #

(Functor f, Functor g) => Functor (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

fmap :: (a -> b) -> Product f g a -> Product f g b #

(<$) :: a -> Product f g b -> Product f g a #

(MonadFix f, MonadFix g) => MonadFix (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

mfix :: (a -> Product f g a) -> Product f g a #

(Applicative f, Applicative g) => Applicative (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

pure :: a -> Product f g a #

(<*>) :: Product f g (a -> b) -> Product f g a -> Product f g b #

liftA2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c #

(*>) :: Product f g a -> Product f g b -> Product f g b #

(<*) :: Product f g a -> Product f g b -> Product f g a #

(Foldable f, Foldable g) => Foldable (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

fold :: Monoid m => Product f g m -> m #

foldMap :: Monoid m => (a -> m) -> Product f g a -> m #

foldr :: (a -> b -> b) -> b -> Product f g a -> b #

foldr' :: (a -> b -> b) -> b -> Product f g a -> b #

foldl :: (b -> a -> b) -> b -> Product f g a -> b #

foldl' :: (b -> a -> b) -> b -> Product f g a -> b #

foldr1 :: (a -> a -> a) -> Product f g a -> a #

foldl1 :: (a -> a -> a) -> Product f g a -> a #

toList :: Product f g a -> [a] #

null :: Product f g a -> Bool #

length :: Product f g a -> Int #

elem :: Eq a => a -> Product f g a -> Bool #

maximum :: Ord a => Product f g a -> a #

minimum :: Ord a => Product f g a -> a #

sum :: Num a => Product f g a -> a #

product :: Num a => Product f g a -> a #

(Traversable f, Traversable g) => Traversable (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Product f g a -> f0 (Product f g b) #

sequenceA :: Applicative f0 => Product f g (f0 a) -> f0 (Product f g a) #

mapM :: Monad m => (a -> m b) -> Product f g a -> m (Product f g b) #

sequence :: Monad m => Product f g (m a) -> m (Product f g a) #

(Eq1 f, Eq1 g) => Eq1 (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

liftEq :: (a -> b -> Bool) -> Product f g a -> Product f g b -> Bool #

(Ord1 f, Ord1 g) => Ord1 (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

liftCompare :: (a -> b -> Ordering) -> Product f g a -> Product f g b -> Ordering #

(Read1 f, Read1 g) => Read1 (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Product f g a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Product f g a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Product f g a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Product f g a] #

(Show1 f, Show1 g) => Show1 (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Product f g a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Product f g a] -> ShowS #

(MonadZip f, MonadZip g) => MonadZip (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

mzip :: Product f g a -> Product f g b -> Product f g (a, b) #

mzipWith :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c #

munzip :: Product f g (a, b) -> (Product f g a, Product f g b) #

(Alternative f, Alternative g) => Alternative (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

empty :: Product f g a #

(<|>) :: Product f g a -> Product f g a -> Product f g a #

some :: Product f g a -> Product f g [a] #

many :: Product f g a -> Product f g [a] #

(MonadPlus f, MonadPlus g) => MonadPlus (Product f g) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

mzero :: Product f g a #

mplus :: Product f g a -> Product f g a -> Product f g a #

(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 #

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

Defined in AST.Class.Pointed

Methods

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

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

Defined in AST.Class.Apply

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

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

Defined in AST.Class.ZipMatch

Methods

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

(Eq (f a), Eq (g a)) => Eq (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

(==) :: Product f g a -> Product f g a -> Bool #

(/=) :: Product f g a -> Product f g a -> Bool #

(Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => Data (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g0. g0 -> c g0) -> Product f g a -> c (Product f g a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Product f g a) #

toConstr :: Product f g a -> Constr #

dataTypeOf :: Product f g a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Product f g a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Product f g a)) #

gmapT :: (forall b. Data b => b -> b) -> Product f g a -> Product f g a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Product f g a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Product f g a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Product f g a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Product f g a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Product f g a -> m (Product f g a) #

(Ord (f a), Ord (g a)) => Ord (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

compare :: Product f g a -> Product f g a -> Ordering #

(<) :: Product f g a -> Product f g a -> Bool #

(<=) :: Product f g a -> Product f g a -> Bool #

(>) :: Product f g a -> Product f g a -> Bool #

(>=) :: Product f g a -> Product f g a -> Bool #

max :: Product f g a -> Product f g a -> Product f g a #

min :: Product f g a -> Product f g a -> Product f g a #

(Read (f a), Read (g a)) => Read (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

readsPrec :: Int -> ReadS (Product f g a) #

readList :: ReadS [Product f g a] #

readPrec :: ReadPrec (Product f g a) #

readListPrec :: ReadPrec [Product f g a] #

(Show (f a), Show (g a)) => Show (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Methods

showsPrec :: Int -> Product f g a -> ShowS #

show :: Product f g a -> String #

showList :: [Product f g a] -> ShowS #

Generic (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

Associated Types

type Rep (Product f g a) :: Type -> Type #

Methods

from :: Product f g a -> Rep (Product f g a) x #

to :: Rep (Product f g a) x -> Product f g a #

type Rep1 (Product f g :: k -> Type) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

type Rep1 (Product f g :: k -> Type) = D1 (MetaData "Product" "Data.Functor.Product.PolyKinds" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "Pair" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g)))
data KWitness (Product a b) n Source # 
Instance details

Defined in AST.Class.Nodes

type KNodesConstraint (Product a b) x Source # 
Instance details

Defined in AST.Class.Nodes

type Rep (Product f g a) Source # 
Instance details

Defined in Data.Functor.Product.PolyKinds

type Rep (Product f g a) = D1 (MetaData "Product" "Data.Functor.Product.PolyKinds" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "Pair" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f a)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g a))))

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.

class KNodes k => KPointed k where Source #

A variant of Pointed for Knots

Methods

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

Construct a value from a generator of k's nodes (a generator which can generate a tree of any type given a witness that it is a node of k)

Instances
KPointed Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KPointed Prune Source # 
Instance details

Defined in AST.Knot.Prune

Methods

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

KPointed (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

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

Applicative f => KPointed (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

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

KPointed (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Methods

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

KPointed (App expr) Source # 
Instance details

Defined in AST.Term.App

Methods

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

KPointed (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

Monoid a => KPointed (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Pointed

Methods

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

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

Defined in AST.Combinator.Compose

Methods

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

Applicative (Map k) => KPointed (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Methods

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

Monoid v => KPointed (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Methods

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

Monoid (Tree varTypes QVars) => KPointed (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

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

KPointed (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Methods

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

Monoid nomId => KPointed (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

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

Monoid nomId => KPointed (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

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

Monoid v => KPointed (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Methods

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

Monoid v => KPointed (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Methods

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

KPointed (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

Monoid a => KPointed (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

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

Defined in AST.Class.Pointed

Methods

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

Applicative (Map key) => KPointed (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

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

Monoid key => KPointed (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

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

Monoid var => KPointed (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Methods

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

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.

class (KPointed k, KApply k) => KApplicative k Source #

A variant of Applicative for Knots.

Instances
(KPointed k, KApply k) => KApplicative k Source # 
Instance details

Defined in AST.Class.Apply

class KFunctor k => KApply k where Source #

A variant of Apply for Knots.

A type which has KApply and KPointed instances also has KApplicative, which is the equivalent to the Applicative class.

Methods

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

Combine child values

>>> zipK (Person name0 age0) (Person name1 age1)
Person (Pair name0 name1) (Pair age0 age1)
Instances
KApply Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KApply Prune Source # 
Instance details

Defined in AST.Knot.Prune

Methods

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

KApply (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

zipK :: Tree (ANode c) p -> Tree (ANode c) q -> Tree (ANode c) (Product p q) Source #

Applicative f => KApply (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

zipK :: Tree (F f) p -> Tree (F f) q -> Tree (F f) (Product p 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 #

KApply (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Methods

zipK :: Tree (FuncType typ) p -> Tree (FuncType typ) q -> Tree (FuncType typ) (Product p q) Source #

KApply (App expr) Source # 
Instance details

Defined in AST.Term.App

Methods

zipK :: Tree (App expr) p -> Tree (App expr) q -> Tree (App expr) (Product p q) Source #

KApply (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

zipK :: Tree (ScopeTypes t) p -> Tree (ScopeTypes t) q -> Tree (ScopeTypes t) (Product p q) Source #

Semigroup a => KApply (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Apply

Methods

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

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

Defined in AST.Combinator.Compose

Methods

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

Applicative (Map k) => KApply (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Methods

zipK :: Tree (TermMap k expr) p -> Tree (TermMap k expr) q -> Tree (TermMap k expr) (Product p q) Source #

Semigroup v => KApply (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Methods

zipK :: Tree (Var v expr) p -> Tree (Var v expr) q -> Tree (Var v expr) (Product p q) Source #

Semigroup (Tree varTypes QVars) => KApply (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

zipK :: Tree (Scheme varTypes typ) p -> Tree (Scheme varTypes typ) q -> Tree (Scheme varTypes typ) (Product p q) Source #

KApply (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Methods

zipK :: Tree (TypeSig vars term) p -> Tree (TypeSig vars term) q -> Tree (TypeSig vars term) (Product p q) Source #

Semigroup nomId => KApply (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

zipK :: Tree (FromNom nomId term) p -> Tree (FromNom nomId term) q -> Tree (FromNom nomId term) (Product p q) Source #

Semigroup nomId => KApply (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

zipK :: Tree (ToNom nomId term) p -> Tree (ToNom nomId term) q -> Tree (ToNom nomId term) (Product p q) Source #

Semigroup v => KApply (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Methods

zipK :: Tree (Let v expr) p -> Tree (Let v expr) q -> Tree (Let v expr) (Product p q) Source #

Semigroup v => KApply (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Methods

zipK :: Tree (Lam v expr) p -> Tree (Lam v expr) q -> Tree (Lam v expr) (Product p q) Source #

KApply (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

Semigroup a => KApply (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

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

Defined in AST.Class.Apply

Methods

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

Applicative (Map key) => KApply (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

zipK :: Tree (FlatRowExtends key val rest) p -> Tree (FlatRowExtends key val rest) q -> Tree (FlatRowExtends key val rest) (Product p q) Source #

Semigroup key => KApply (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

zipK :: Tree (RowExtend key val rest) p -> Tree (RowExtend key val rest) q -> Tree (RowExtend key val rest) (Product p q) Source #

Semigroup var => KApply (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Methods

zipK :: Tree (TypedLam var typ expr) p -> Tree (TypedLam var typ expr) q -> Tree (TypedLam var typ expr) (Product p q) Source #

liftK2 :: KApply k => (forall n. KWitness k n -> Tree p n -> Tree q n -> Tree r n) -> Tree k p -> Tree k q -> Tree k r Source #

KApply variant of liftA2

makeKApplicativeBases :: Name -> DecsQ Source #

Generate instances of KApply, KFunctor, KPointed and KNodes, which together form KApplicative.

class KNodes k => KFoldable k where Source #

A variant of Foldable for Knots

Methods

foldMapK :: Monoid a => (forall n. KWitness k n -> Tree p n -> a) -> Tree k p -> a Source #

KFoldable variant of foldMap

Gets a function from k's nodes (trees along witnesses that they are nodes of k) into a monoid and concats its results for all nodes.

Instances
KFoldable Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KFoldable Prune Source # 
Instance details

Defined in AST.Knot.Prune

Methods

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

KFoldable (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

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

Foldable f => KFoldable (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (F f) n -> Tree p n -> a) -> Tree (F f) p -> a 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 #

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

Defined in AST.Unify.Error

Methods

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

KFoldable (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Methods

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

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

Defined in AST.Term.Nominal

Methods

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

KFoldable (NominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

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

KFoldable (App expr) Source # 
Instance details

Defined in AST.Term.App

Methods

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

KFoldable (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Unify.Generalize

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (Flip GTerm ast) n -> Tree p n -> a) -> Tree (Flip GTerm ast) p -> a Source #

(Recursively KFoldable e, Recursively KFoldableInferOf e) => KFoldable (Flip (ITerm a) e) Source # 
Instance details

Defined in AST.Infer.Term

Methods

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

(Recursively KFoldable e, Recursively KFoldableInferOf e) => KFoldable (Flip (BTerm a) e) Source # 
Instance details

Defined in AST.Infer.Blame

Methods

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

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

Defined in AST.Combinator.Compose

Methods

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

KFoldable (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (TermMap k expr) n -> Tree p n -> a) -> Tree (TermMap k expr) p -> a Source #

KFoldable (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (Var v expr) n -> Tree p n -> a) -> Tree (Var v expr) p -> a Source #

KFoldable (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (Scheme varTypes typ) n -> Tree p n -> a) -> Tree (Scheme varTypes typ) p -> a Source #

KFoldable (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (TypeSig vars term) n -> Tree p n -> a) -> Tree (TypeSig vars term) p -> a Source #

KFoldable (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (FromNom nomId term) n -> Tree p n -> a) -> Tree (FromNom nomId term) p -> a Source #

KFoldable (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (ToNom nomId term) n -> Tree p n -> a) -> Tree (ToNom nomId term) p -> a Source #

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

Defined in AST.Term.Nominal

Methods

foldMapK :: Monoid a => (forall (n0 :: Knot -> Type). KWitness (NominalInst n v) n0 -> Tree p n0 -> a) -> Tree (NominalInst n v) p -> a Source #

KFoldable (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (Let v expr) n -> Tree p n -> a) -> Tree (Let v expr) p -> a Source #

KFoldable (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (Lam v expr) n -> Tree p n -> a) -> Tree (Lam v expr) p -> a Source #

KFoldable (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

KFoldable (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

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

Defined in AST.Class.Foldable

Methods

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

KFoldable (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (FlatRowExtends key val rest) n -> Tree p n -> a) -> Tree (FlatRowExtends key val rest) p -> a Source #

KFoldable (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (RowExtend key val rest) n -> Tree p n -> a) -> Tree (RowExtend key val rest) p -> a Source #

KFoldable (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Methods

foldMapK :: Monoid a => (forall (n :: Knot -> Type). KWitness (TypedLam var typ expr) n -> Tree p n -> a) -> Tree (TypedLam var typ expr) p -> a Source #

traverseK_ :: (Applicative f, KFoldable k) => (forall c. KWitness k c -> Tree m c -> f ()) -> Tree k m -> f () Source #

KFoldable variant of traverse_

Applise a given action on all subtrees (represented as trees along witnesses that they are nodes of k)

traverseK1_ :: forall f k n p. (Applicative f, KFoldable k, KNodesConstraint k ((~) n)) => (Tree p n -> f ()) -> Tree k p -> f () Source #

KFoldable variant of traverse_ for Knots with a single node type (avoids using RankNTypes)

class (KFunctor k, KFoldable k) => KTraversable k where Source #

A variant of Traversable for Knots

Methods

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

Instances
KTraversable Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KTraversable Prune Source # 
Instance details

Defined in AST.Knot.Prune

Methods

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

KTraversable (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

sequenceK :: Applicative f => Tree (ANode c) (ContainedK f p) -> f (Tree (ANode c) p) Source #

Traversable f => KTraversable (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

sequenceK :: Applicative f0 => Tree (F f) (ContainedK f0 p) -> f0 (Tree (F f) p) 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 #

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

Defined in AST.Unify.Error

Methods

sequenceK :: Applicative f => Tree (UnifyError t) (ContainedK f p) -> f (Tree (UnifyError t) p) Source #

KTraversable (FuncType typ) Source # 
Instance details

Defined in AST.Term.FuncType

Methods

sequenceK :: Applicative f => Tree (FuncType typ) (ContainedK f p) -> f (Tree (FuncType typ) p) Source #

(RTraversable typ, KTraversable (NomVarTypes typ)) => KTraversable (LoadedNominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

KTraversable (NominalDecl typ) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

sequenceK :: Applicative f => Tree (NominalDecl typ) (ContainedK f p) -> f (Tree (NominalDecl typ) p) Source #

KTraversable (App expr) Source # 
Instance details

Defined in AST.Term.App

Methods

sequenceK :: Applicative f => Tree (App expr) (ContainedK f p) -> f (Tree (App expr) p) Source #

KTraversable (ScopeTypes t) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

sequenceK :: Applicative f => Tree (ScopeTypes t) (ContainedK f p) -> f (Tree (ScopeTypes t) p) Source #

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

Defined in AST.Class.Traversable

Methods

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

RTraversable ast => KTraversable (Flip GTerm ast) Source # 
Instance details

Defined in AST.Unify.Generalize

Methods

sequenceK :: Applicative f => Tree (Flip GTerm ast) (ContainedK f p) -> f (Tree (Flip GTerm ast) p) Source #

(RTraversable e, RTraversableInferOf e) => KTraversable (Flip (ITerm a) e) Source # 
Instance details

Defined in AST.Infer.Term

Methods

sequenceK :: Applicative f => Tree (Flip (ITerm a) e) (ContainedK f p) -> f (Tree (Flip (ITerm a) e) p) Source #

(RTraversable e, RTraversableInferOf e) => KTraversable (Flip (BTerm a) e) Source # 
Instance details

Defined in AST.Infer.Blame

Methods

sequenceK :: Applicative f => Tree (Flip (BTerm a) e) (ContainedK f p) -> f (Tree (Flip (BTerm a) e) p) Source #

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

Defined in AST.Combinator.Compose

Methods

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

KTraversable (TermMap k expr) Source # 
Instance details

Defined in AST.Term.Map

Methods

sequenceK :: Applicative f => Tree (TermMap k expr) (ContainedK f p) -> f (Tree (TermMap k expr) p) Source #

KTraversable (Var v expr) Source # 
Instance details

Defined in AST.Term.Var

Methods

sequenceK :: Applicative f => Tree (Var v expr) (ContainedK f p) -> f (Tree (Var v expr) p) Source #

KTraversable (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

sequenceK :: Applicative f => Tree (Scheme varTypes typ) (ContainedK f p) -> f (Tree (Scheme varTypes typ) p) Source #

KTraversable (TypeSig vars term) Source # 
Instance details

Defined in AST.Term.TypeSig

Methods

sequenceK :: Applicative f => Tree (TypeSig vars term) (ContainedK f p) -> f (Tree (TypeSig vars term) p) Source #

KTraversable (FromNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

sequenceK :: Applicative f => Tree (FromNom nomId term) (ContainedK f p) -> f (Tree (FromNom nomId term) p) Source #

KTraversable (ToNom nomId term) Source # 
Instance details

Defined in AST.Term.Nominal

Methods

sequenceK :: Applicative f => Tree (ToNom nomId term) (ContainedK f p) -> f (Tree (ToNom nomId term) p) Source #

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

Defined in AST.Term.Nominal

Methods

sequenceK :: Applicative f => Tree (NominalInst n v) (ContainedK f p) -> f (Tree (NominalInst n v) p) Source #

KTraversable (Let v expr) Source # 
Instance details

Defined in AST.Term.Let

Methods

sequenceK :: Applicative f => Tree (Let v expr) (ContainedK f p) -> f (Tree (Let v expr) p) Source #

KTraversable (Lam v expr) Source # 
Instance details

Defined in AST.Term.Lam

Methods

sequenceK :: Applicative f => Tree (Lam v expr) (ContainedK f p) -> f (Tree (Lam v expr) p) Source #

KTraversable (Scope expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

KTraversable (ScopeVar expr a) Source # 
Instance details

Defined in AST.Term.NamelessScope

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

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

Defined in AST.Class.Traversable

Methods

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

KTraversable (FlatRowExtends key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

sequenceK :: Applicative f => Tree (FlatRowExtends key val rest) (ContainedK f p) -> f (Tree (FlatRowExtends key val rest) p) Source #

KTraversable (RowExtend key val rest) Source # 
Instance details

Defined in AST.Term.Row

Methods

sequenceK :: Applicative f => Tree (RowExtend key val rest) (ContainedK f p) -> f (Tree (RowExtend key val rest) p) Source #

KTraversable (TypedLam var typ expr) Source # 
Instance details

Defined in AST.Term.TypedLam

Methods

sequenceK :: Applicative f => Tree (TypedLam var typ expr) (ContainedK f p) -> f (Tree (TypedLam var typ expr) p) Source #

traverseK :: (Applicative f, KTraversable k) => (forall n. KWitness k n -> Tree p n -> f (Tree q n)) -> Tree k p -> f (Tree k q) Source #

traverseK1 :: (KTraversable k, KNodesConstraint k ((~) n)) => Traversal (Tree k p) (Tree k q) (Tree p n) (Tree q n) Source #

KTraversable variant of traverse for Knots with a single node type.

It is a valid Traversal as it avoids using RankNTypes.

makeKTraversableApplyAndBases :: Name -> DecsQ Source #

Generate KTraversable and KApply instances along with all of their base classes: KFoldable, KFunctor, KPointed, and KNodes.

makeKTraversableAndBases :: Name -> DecsQ Source #

Generate a KTraversable instance along with the instance of its base classes: KFoldable, KFunctor, and KNodes.

newtype Pure k Source #

A Knot to express the simplest plain form of a nested higher-kinded data structure

Constructors

Pure (k # Pure) 
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 #

KPointed Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

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 #

KApply Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KFoldable Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

KTraversable Pure Source # 
Instance details

Defined in AST.Knot.Pure

Methods

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

ZipMatch Pure Source # 
Instance details

Defined in AST.Class.ZipMatch

Methods

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

RTraversable Pure Source # 
Instance details

Defined in AST.Class.Recursive

RNodes Pure Source # 
Instance details

Defined in AST.Class.Recursive

KMonad Pure Source # 
Instance details

Defined in AST.Class.Monad

c Pure => Recursively c Pure Source # 
Instance details

Defined in AST.Class.Recursive

Constraints (Pure k) Eq => Eq (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

(==) :: Pure k -> Pure k -> Bool #

(/=) :: Pure k -> Pure k -> Bool #

Constraints (Pure k) Ord => Ord (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

compare :: Pure k -> Pure k -> Ordering #

(<) :: Pure k -> Pure k -> Bool #

(<=) :: Pure k -> Pure k -> Bool #

(>) :: Pure k -> Pure k -> Bool #

(>=) :: Pure k -> Pure k -> Bool #

max :: Pure k -> Pure k -> Pure k #

min :: Pure k -> Pure k -> Pure k #

Constraints (Pure k) Show => Show (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

showsPrec :: Int -> Pure k -> ShowS #

show :: Pure k -> String #

showList :: [Pure k] -> ShowS #

Generic (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Associated Types

type Rep (Pure k) :: Type -> Type #

Methods

from :: Pure k -> Rep (Pure k) x #

to :: Rep (Pure k) x -> Pure k #

Constraints (Pure k) Binary => Binary (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

put :: Pure k -> Put #

get :: Get (Pure k) #

putList :: [Pure k] -> Put #

Constraints (Pure k) NFData => NFData (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

rnf :: Pure k -> () #

Pretty (k # Pure) => Pretty (Pure k) Source # 
Instance details

Defined in AST.Knot.Pure

Methods

pPrintPrec :: PrettyLevel -> Rational -> Pure k -> Doc #

pPrint :: Pure k -> Doc #

pPrintList :: PrettyLevel -> [Pure k] -> Doc #

data KWitness Pure node Source # 
Instance details

Defined in AST.Knot.Pure

data KWitness Pure node where
type KNodesConstraint Pure constraint Source # 
Instance details

Defined in AST.Knot.Pure

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

Defined in AST.Knot.Pure

type Rep (Pure k) = D1 (MetaData "Pure" "AST.Knot.Pure" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" True) (C1 (MetaCons "Pure" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (k # Pure))))

_Pure :: Iso (Tree Pure k) (Tree Pure j) (Tree k Pure) (Tree j Pure) Source #

An Iso from Pure to its content.

Using _Pure rather than the Pure data constructor is recommended, because it helps the type inference know that Pure is parameterized with a Knot.

(&#) :: a -> (a -> Tree k Pure) -> Tree Pure k infixl 1 Source #

An operator to apply a function to a value and wrap it with Pure.

Helps value construction be more succinct.

The etymology and fixity of &# operator mimics &.

>>> x &# f
Pure (f x)

class Show (KPlain k) => KHasPlain k where Source #

A class for a plain for of a Tree Pure k

Associated Types

data KPlain k Source #

Plain form data type

Methods

kPlain :: Iso' (KPlain k) (Tree Pure k) Source #

An Iso between the plain and knotted forms

makeKHasPlain :: [Name] -> DecsQ Source #

Generate a KHasPlain instance

newtype ANode c k Source #

ANode c is a Knot with a single child node of type c

Constructors

MkANode (k # c) 
Instances
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 #

KPointed (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

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

KApply (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

zipK :: Tree (ANode c) p -> Tree (ANode c) q -> Tree (ANode c) (Product p q) Source #

KFoldable (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

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

KTraversable (ANode c) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

sequenceK :: Applicative f => Tree (ANode c) (ContainedK f p) -> f (Tree (ANode c) p) Source #

HasChild (ANode c) c Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

getChild :: Lens' (Tree (ANode c) k) (Tree k c) Source #

Constraints (ANode c k) Eq => Eq (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

(==) :: ANode c k -> ANode c k -> Bool #

(/=) :: ANode c k -> ANode c k -> Bool #

Constraints (ANode c k) Ord => Ord (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

compare :: ANode c k -> ANode c k -> Ordering #

(<) :: ANode c k -> ANode c k -> Bool #

(<=) :: ANode c k -> ANode c k -> Bool #

(>) :: ANode c k -> ANode c k -> Bool #

(>=) :: ANode c k -> ANode c k -> Bool #

max :: ANode c k -> ANode c k -> ANode c k #

min :: ANode c k -> ANode c k -> ANode c k #

Constraints (ANode c k) Show => Show (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

showsPrec :: Int -> ANode c k -> ShowS #

show :: ANode c k -> String #

showList :: [ANode c k] -> ShowS #

Generic (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Associated Types

type Rep (ANode c k) :: Type -> Type #

Methods

from :: ANode c k -> Rep (ANode c k) x #

to :: Rep (ANode c k) x -> ANode c k #

Constraints (ANode c k) Binary => Binary (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

put :: ANode c k -> Put #

get :: Get (ANode c k) #

putList :: [ANode c k] -> Put #

Constraints (ANode c k) NFData => NFData (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

Methods

rnf :: ANode c k -> () #

data KWitness (ANode c) node Source # 
Instance details

Defined in AST.Combinator.ANode

data KWitness (ANode c) node where
type KNodesConstraint (ANode c) constraint Source # 
Instance details

Defined in AST.Combinator.ANode

type KNodesConstraint (ANode c) constraint = constraint c
type Rep (ANode c k) Source # 
Instance details

Defined in AST.Combinator.ANode

type Rep (ANode c k) = D1 (MetaData "ANode" "AST.Combinator.ANode" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" True) (C1 (MetaCons "MkANode" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (k # c))))

_ANode :: Iso (Tree (ANode c0) k0) (Tree (ANode c1) k1) (Tree k0 c0) (Tree k1 c1) Source #

An Iso from ANode its child node.

Using _ANode rather than the MkANode data constructor is recommended, because it helps the type inference know that ANode c is parameterized with a Knot.

makeZipMatch :: Name -> DecsQ Source #

Generate a ZipMatch instance

class RNodes k => Recursively c k where Source #

A constraint lifted to apply recursively.

Note that in cases where a constraint has dependencies other than RNodes, one will want to create a class such as RTraversable to capture the dependencies, otherwise using it in class contexts will be quite unergonomic.

Minimal complete definition

Nothing

Instances
c Pure => Recursively c Pure Source # 
Instance details

Defined in AST.Class.Recursive

c Prune => Recursively c Prune Source # 
Instance details

Defined in AST.Knot.Prune

c (F f) => Recursively c (F f) Source # 
Instance details

Defined in AST.Knot.Functor

Methods

recursively :: Proxy (c (F f)) -> Dict (c (F f), KNodesConstraint (F f) (Recursively c)) Source #

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 #

c (Const a :: Knot -> Type) => Recursively c (Const a :: Knot -> Type) Source # 
Instance details

Defined in AST.Class.Recursive

Methods

recursively :: Proxy (c (Const a)) -> Dict (c (Const a), KNodesConstraint (Const a) (Recursively c)) Source #

(c (Scheme v t), Recursively c t) => Recursively c (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

recursively :: Proxy (c (Scheme v t)) -> Dict (c (Scheme v t), KNodesConstraint (Scheme v t) (Recursively c)) Source #

Recursive (Recursively c) Source # 
Instance details

Defined in AST.Class.Recursive

class KNodes k => RNodes k Source #

A class of Knots which recursively implement KNodes

Instances
RNodes Pure Source # 
Instance details

Defined in AST.Class.Recursive

RNodes Prune Source # 
Instance details

Defined in AST.Knot.Prune

Recursive RNodes Source # 
Instance details

Defined in AST.Class.Recursive

RNodes (F f) Source # 
Instance details

Defined in AST.Knot.Functor

RNodes (Ann a) Source # 
Instance details

Defined in AST.Knot.Ann

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

Defined in AST.Class.Recursive

RNodes t => RNodes (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

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 #

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