Stability | experimental |
---|---|
Maintainer | developer@flocc.net |
Safe Haskell | None |
For more information please see http://www.flocc.net/
- buildTermsForExpr :: (Show t, ShowP t, Eq t, Monad a) => FuncEnv t -> Expr -> (FuncEnv t -> Expr -> StateT (FuncEnv t) (StateT IdxSet a) ([FuncConstr t], FuncTerm t)) -> StateT (FuncEnv t) (StateT IdxSet a) ([FuncConstr t], FuncTerm t)
- performConstraintAnalysis :: (Monad a, Eq t, Show l, Show t, ShowP t) => (TermEnv l t -> Expr -> StateT (TermEnv l t) (StateT IdxSet a) ([Constr (Term l t)], Term l t)) -> TermEnv l t -> Expr -> StateT IdxSet a (Either (TermEnv l t) (Constr (Term l t)))
- scm :: Show t => [FuncTerm t] -> FuncTerm t -> FuncScheme t
- tup :: [FuncTerm t] -> FuncTerm t
- fun :: FuncTerm t -> FuncTerm t -> FuncTerm t
- vara :: FuncTerm t
- varb :: FuncTerm t
- varc :: FuncTerm t
- vard :: FuncTerm t
- vare :: FuncTerm t
- varf :: FuncTerm t
- varg :: FuncTerm t
- varh :: FuncTerm t
- vari :: FuncTerm t
- varj :: FuncTerm t
- vark :: FuncTerm t
- varl :: FuncTerm t
- initTermEnvInState :: Monad a => Term l t -> IdxTree -> StateT (TermEnvStack l t) a ()
- data ExpLbl
- type FuncTerm t = Term ExpLbl (FunctionToken t)
- type FuncEnv t = TermEnv ExpLbl (FunctionToken t)
- type FuncConstr t = Constr (FuncTerm t)
- type FuncScheme t = Scheme ExpLbl (FunctionToken t)
- type Substs t = [Subst t]
- composeSubsts :: Substs t -> Substs t -> Substs t
- nullSubsts :: Substs t
- applySubstsToTerm :: Eq t => Substs (Term l t) -> Term l t -> Term l t
- applySubstsToEnv :: (Eq t, Show t, Show l) => Substs (Term l t) -> TermEnv l t -> TermEnv l t
- applySubstsToConstrs :: Eq t => Substs (Term l t) -> [Constr (Term l t)] -> [Constr (Term l t)]
- type InferenceMonad t m = StateT (FuncEnv t) (StateT IdxSet m) (Substs (FuncTerm t), FuncTerm t)
- type InferenceFunction t m = FuncEnv t -> Expr -> InferenceMonad t m
- inferTerms :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> InferenceMonad t m
- inferNewTerms :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> InferenceMonad t m
- runTermInferencer :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> StateT IdxSet m (Either (FuncEnv t) (Constr (Term ExpLbl t)))
- runNewTermInferencer :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> FuncEnv t -> Expr -> StateT IdxSet m (Either (FuncEnv t) (Constr (Term ExpLbl t)))
- inferTermsFoldF :: (Monad m, Show t, Eq t) => InferenceFunction t m -> InferenceFoldType t -> Expr -> StateT (FuncEnv t) (StateT IdxSet m) (InferenceFoldType t)
- inferEqTermsFoldF :: (Monad m, Show t, Eq t) => InferenceFunction t m -> InferenceFoldType t -> Expr -> StateT (FuncEnv t) (StateT IdxSet m) (InferenceFoldType t)
- addAConstraint :: (Show t, ShowP t, Show l, Eq t) => Term l t -> Term l t -> Term l t -> Maybe (Term l t)
- buildForIdxTree :: Monad a => IdxTree -> StateT (FuncEnv t) (StateT IdxSet a) (FuncEnv t, FuncTerm t)
Documentation
buildTermsForExpr :: (Show t, ShowP t, Eq t, Monad a) => FuncEnv t -> Expr -> (FuncEnv t -> Expr -> StateT (FuncEnv t) (StateT IdxSet a) ([FuncConstr t], FuncTerm t)) -> StateT (FuncEnv t) (StateT IdxSet a) ([FuncConstr t], FuncTerm t)
Helper function for building term environments for expr trees. May be called from an overriding
function (with the overriding
|function passed as the third argument so that control can be passed back to it in the recursive case).
performConstraintAnalysis :: (Monad a, Eq t, Show l, Show t, ShowP t) => (TermEnv l t -> Expr -> StateT (TermEnv l t) (StateT IdxSet a) ([Constr (Term l t)], Term l t)) -> TermEnv l t -> Expr -> StateT IdxSet a (Either (TermEnv l t) (Constr (Term l t)))
Takes a variable environment, term builder function and expression and returns either |a unified term environment solution to the analysis, or a failing constraint.
scm :: Show t => [FuncTerm t] -> FuncTerm t -> FuncScheme t
initTermEnvInState :: Monad a => Term l t -> IdxTree -> StateT (TermEnvStack l t) a ()
Initialize the current level of the TermEnvStack using this IdxTree pattern
type FuncTerm t = Term ExpLbl (FunctionToken t)
type FuncEnv t = TermEnv ExpLbl (FunctionToken t)
type FuncConstr t = Constr (FuncTerm t)
type FuncScheme t = Scheme ExpLbl (FunctionToken t)
composeSubsts :: Substs t -> Substs t -> Substs t
Compose substitution lists such that s2 is applied first, then s1
nullSubsts :: Substs t
applySubstsToTerm :: Eq t => Substs (Term l t) -> Term l t -> Term l t
Apply all substitutions to the term
applySubstsToEnv :: (Eq t, Show t, Show l) => Substs (Term l t) -> TermEnv l t -> TermEnv l t
Apply all substitutions to the term/scheme environment
applySubstsToConstrs :: Eq t => Substs (Term l t) -> [Constr (Term l t)] -> [Constr (Term l t)]
Apply all substitutions to the constraint list
type InferenceMonad t m = StateT (FuncEnv t) (StateT IdxSet m) (Substs (FuncTerm t), FuncTerm t)
The state monad used by inference functions
type InferenceFunction t m = FuncEnv t -> Expr -> InferenceMonad t m
The type of an inference function
inferTerms :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> InferenceMonad t m
Base function for all term inferencers
inferNewTerms :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> InferenceMonad t m
Term inferencer function where only terms who's terms |do not already exist in the state are investigated.
runTermInferencer :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> Expr -> StateT IdxSet m (Either (FuncEnv t) (Constr (Term ExpLbl t)))
Function that performs term inference using the inference function provided
runNewTermInferencer :: (Monad m, Show t, ShowP t, Eq t) => InferenceFunction t m -> FuncEnv t -> FuncEnv t -> Expr -> StateT IdxSet m (Either (FuncEnv t) (Constr (Term ExpLbl t)))
Function that performs term inference using the inference function provided
inferTermsFoldF :: (Monad m, Show t, Eq t) => InferenceFunction t m -> InferenceFoldType t -> Expr -> StateT (FuncEnv t) (StateT IdxSet m) (InferenceFoldType t)
Binary operator to fold over a list of expressions. |Note: Term list returned in reverse order, need to apply reverse to it.
inferEqTermsFoldF :: (Monad m, Show t, Eq t) => InferenceFunction t m -> InferenceFoldType t -> Expr -> StateT (FuncEnv t) (StateT IdxSet m) (InferenceFoldType t)
Binary operator to fold over a list of expressions, with |the added constraint that all terms in the list are equal. |Note: Term list returned in reverse order, need to apply reverse to it.