syntax-tree-0.1.0.1: Typed ASTs

Safe HaskellNone
LanguageHaskell2010

AST.Term.Scheme

Description

Type schemes

Synopsis

Documentation

data Scheme varTypes typ k Source #

A type scheme representing a polymorphic type.

Constructors

Scheme 

Fields

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

(Monad m, HasInferredValue typ, Unify m typ, KTraversable varTypes, KNodesConstraint varTypes (MonadInstantiate m), RTraversable typ, Infer m typ) => Infer m (Scheme varTypes typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

inferBody :: Tree (Scheme varTypes typ) (InferChild m k) -> m (Tree (Scheme varTypes typ) k, Tree (InferOf (Scheme varTypes typ)) (UVarOf m)) Source #

inferContext :: Proxy m -> Proxy (Scheme varTypes typ) -> Dict (KNodesConstraint (Scheme varTypes typ) (Infer m), KNodesConstraint (InferOf (Scheme varTypes typ)) (Unify m)) Source #

(RNodes t, c t, Recursive c, ITermVarsConstraint c t) => ITermVarsConstraint c (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

iTermVarsConstraintCtx :: Proxy c -> Proxy (Scheme v t) -> Dict (ITermVarsConstraintContext c (Scheme v t)) 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 #

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 #

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 #

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 #

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 #

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 (Scheme v t), RTraversable t) => RTraversable (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

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

Defined in AST.Term.Scheme

(RTraversable t, RTraversableInferOf t) => RTraversableInferOf (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

Constraints (Scheme varTypes typ k) Eq => Eq (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

(==) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

(/=) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

Constraints (Scheme varTypes typ k) Ord => Ord (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

compare :: Scheme varTypes typ k -> Scheme varTypes typ k -> Ordering #

(<) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

(<=) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

(>) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

(>=) :: Scheme varTypes typ k -> Scheme varTypes typ k -> Bool #

max :: Scheme varTypes typ k -> Scheme varTypes typ k -> Scheme varTypes typ k #

min :: Scheme varTypes typ k -> Scheme varTypes typ k -> Scheme varTypes typ k #

Constraints (Scheme varTypes typ k) Show => Show (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

showsPrec :: Int -> Scheme varTypes typ k -> ShowS #

show :: Scheme varTypes typ k -> String #

showList :: [Scheme varTypes typ k] -> ShowS #

Generic (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Associated Types

type Rep (Scheme varTypes typ k) :: Type -> Type #

Methods

from :: Scheme varTypes typ k -> Rep (Scheme varTypes typ k) x #

to :: Rep (Scheme varTypes typ k) x -> Scheme varTypes typ k #

Constraints (Scheme varTypes typ k) Binary => Binary (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

put :: Scheme varTypes typ k -> Put #

get :: Get (Scheme varTypes typ k) #

putList :: [Scheme varTypes typ k] -> Put #

Constraints (Scheme varTypes typ k) NFData => NFData (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

rnf :: Scheme varTypes typ k -> () #

(Pretty (Tree varTypes QVars), Pretty (k # typ)) => Pretty (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

pPrintPrec :: PrettyLevel -> Rational -> Scheme varTypes typ k -> Doc #

pPrint :: Scheme varTypes typ k -> Doc #

pPrintList :: PrettyLevel -> [Scheme varTypes typ k] -> Doc #

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

Defined in AST.Term.Scheme

data KWitness (Scheme varTypes typ) node where
type InferOf (Scheme v t) Source # 
Instance details

Defined in AST.Term.Scheme

type InferOf (Scheme v t) = Flip GTerm t
type KNodesConstraint (Scheme varTypes typ) constraint Source # 
Instance details

Defined in AST.Term.Scheme

type KNodesConstraint (Scheme varTypes typ) constraint = constraint typ
type Rep (Scheme varTypes typ k) Source # 
Instance details

Defined in AST.Term.Scheme

type Rep (Scheme varTypes typ k) = D1 (MetaData "Scheme" "AST.Term.Scheme" "syntax-tree-0.1.0.1-5Y9WhklreXaDnL6Q9tTtln" False) (C1 (MetaCons "Scheme" PrefixI True) (S1 (MetaSel (Just "_sForAlls") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Tree varTypes QVars)) :*: S1 (MetaSel (Just "_sTyp") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (k # typ))))

sForAlls :: forall varTypes typ k varTypes. Lens (Scheme varTypes typ k) (Scheme varTypes typ k) (Tree varTypes QVars) (Tree varTypes QVars) Source #

sTyp :: forall varTypes typ k typ k. Lens (Scheme varTypes typ k) (Scheme varTypes typ k) ((#) k typ) ((#) k typ) 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

newtype QVars typ Source #

Constructors

QVars (Map (QVar (GetKnot typ)) (TypeConstraintsOf (GetKnot typ))) 
Instances
Constraints (QVars typ) Eq => Eq (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

(==) :: QVars typ -> QVars typ -> Bool #

(/=) :: QVars typ -> QVars typ -> Bool #

Constraints (QVars typ) Ord => Ord (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

compare :: QVars typ -> QVars typ -> Ordering #

(<) :: QVars typ -> QVars typ -> Bool #

(<=) :: QVars typ -> QVars typ -> Bool #

(>) :: QVars typ -> QVars typ -> Bool #

(>=) :: QVars typ -> QVars typ -> Bool #

max :: QVars typ -> QVars typ -> QVars typ #

min :: QVars typ -> QVars typ -> QVars typ #

Constraints (QVars typ) Show => Show (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

showsPrec :: Int -> QVars typ -> ShowS #

show :: QVars typ -> String #

showList :: [QVars typ] -> ShowS #

Generic (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Associated Types

type Rep (QVars typ) :: Type -> Type #

Methods

from :: QVars typ -> Rep (QVars typ) x #

to :: Rep (QVars typ) x -> QVars typ #

(Ord (QVar (GetKnot typ)), Semigroup (TypeConstraintsOf (GetKnot typ))) => Semigroup (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

(<>) :: QVars typ -> QVars typ -> QVars typ #

sconcat :: NonEmpty (QVars typ) -> QVars typ #

stimes :: Integral b => b -> QVars typ -> QVars typ #

(Ord (QVar (GetKnot typ)), Semigroup (TypeConstraintsOf (GetKnot typ))) => Monoid (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

mempty :: QVars typ #

mappend :: QVars typ -> QVars typ -> QVars typ #

mconcat :: [QVars typ] -> QVars typ #

Constraints (QVars typ) Binary => Binary (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

put :: QVars typ -> Put #

get :: Get (QVars typ) #

putList :: [QVars typ] -> Put #

Constraints (QVars typ) NFData => NFData (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

rnf :: QVars typ -> () #

Ord (QVar (GetKnot typ)) => Ixed (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

ix :: Index (QVars typ) -> Traversal' (QVars typ) (IxValue (QVars typ)) #

Ord (QVar (GetKnot typ)) => At (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

at :: Index (QVars typ) -> Lens' (QVars typ) (Maybe (IxValue (QVars typ))) #

(Pretty (TypeConstraintsOf typ), Pretty (QVar typ)) => Pretty (Tree QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

type Rep (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

type Rep (QVars typ) = D1 (MetaData "QVars" "AST.Term.Scheme" "syntax-tree-0.1.0.1-5Y9WhklreXaDnL6Q9tTtln" True) (C1 (MetaCons "QVars" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map (QVar (GetKnot typ)) (TypeConstraintsOf (GetKnot typ))))))
type Index (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

type Index (QVars typ) = QVar (GetKnot typ)
type IxValue (QVars typ) Source # 
Instance details

Defined in AST.Term.Scheme

_QVars :: forall typ typ. Iso (QVars typ) (QVars typ) (Map (QVar (GetKnot typ)) (TypeConstraintsOf (GetKnot typ))) (Map (QVar (GetKnot typ)) (TypeConstraintsOf (GetKnot typ))) Source #

class (Unify m t, HasChild varTypes t, Ord (QVar t)) => HasScheme varTypes m t where Source #

Minimal complete definition

Nothing

Methods

hasSchemeRecursive :: Proxy varTypes -> Proxy m -> Proxy t -> Dict (KNodesConstraint t (HasScheme varTypes m)) Source #

hasSchemeRecursive :: KNodesConstraint t (HasScheme varTypes m) => Proxy varTypes -> Proxy m -> Proxy t -> Dict (KNodesConstraint t (HasScheme varTypes m)) Source #

Instances
Recursive (HasScheme varTypes m) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

recurse :: (KNodes k, HasScheme varTypes m k) => Proxy (HasScheme varTypes m k) -> Dict (KNodesConstraint k (HasScheme varTypes m)) Source #

loadScheme :: forall m varTypes typ. (Monad m, KTraversable varTypes, KNodesConstraint varTypes (Unify m), HasScheme varTypes m typ) => Tree Pure (Scheme varTypes typ) -> m (Tree (GTerm (UVarOf m)) typ) Source #

Load scheme into unification monad so that different instantiations share the scheme's monomorphic parts - their unification is O(1) as it is the same shared unification term.

saveScheme :: (KNodesConstraint varTypes OrdQVar, KPointed varTypes, HasScheme varTypes m typ) => Tree (GTerm (UVarOf m)) typ -> m (Tree Pure (Scheme varTypes typ)) Source #

class Unify m t => MonadInstantiate m t where Source #

Methods

localInstantiations :: Tree (QVarInstances (UVarOf m)) t -> m a -> m a Source #

lookupQVar :: QVar t -> m (Tree (UVarOf m) t) Source #

newtype QVarInstances k typ Source #

Constructors

QVarInstances (Map (QVar (GetKnot typ)) (k typ)) 
Instances
Constraints (QVarInstances k typ) Eq => Eq (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

(==) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

(/=) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

Constraints (QVarInstances k typ) Ord => Ord (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

compare :: QVarInstances k typ -> QVarInstances k typ -> Ordering #

(<) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

(<=) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

(>) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

(>=) :: QVarInstances k typ -> QVarInstances k typ -> Bool #

max :: QVarInstances k typ -> QVarInstances k typ -> QVarInstances k typ #

min :: QVarInstances k typ -> QVarInstances k typ -> QVarInstances k typ #

Constraints (QVarInstances k typ) Show => Show (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

showsPrec :: Int -> QVarInstances k typ -> ShowS #

show :: QVarInstances k typ -> String #

showList :: [QVarInstances k typ] -> ShowS #

Generic (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Associated Types

type Rep (QVarInstances k typ) :: Type -> Type #

Methods

from :: QVarInstances k typ -> Rep (QVarInstances k typ) x #

to :: Rep (QVarInstances k typ) x -> QVarInstances k typ #

Constraints (QVarInstances k typ) Binary => Binary (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

put :: QVarInstances k typ -> Put #

get :: Get (QVarInstances k typ) #

putList :: [QVarInstances k typ] -> Put #

Constraints (QVarInstances k typ) NFData => NFData (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

Methods

rnf :: QVarInstances k typ -> () #

type Rep (QVarInstances k typ) Source # 
Instance details

Defined in AST.Term.Scheme

type Rep (QVarInstances k typ) = D1 (MetaData "QVarInstances" "AST.Term.Scheme" "syntax-tree-0.1.0.1-5Y9WhklreXaDnL6Q9tTtln" True) (C1 (MetaCons "QVarInstances" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map (QVar (GetKnot typ)) (k typ)))))

_QVarInstances :: forall k typ k typ. Iso (QVarInstances k typ) (QVarInstances k typ) (Map (QVar (GetKnot typ)) (k typ)) (Map (QVar (GetKnot typ)) (k typ)) Source #

makeQVarInstances :: Unify m typ => Tree QVars typ -> m (Tree (QVarInstances (UVarOf m)) typ) Source #