flocc-pffb

Stabilityexperimental
Maintainerdeveloper@flocc.net
Safe HaskellNone

Compiler.Types2.EmbeddedFunctions

Description

For more information please see http://www.flocc.net/

Synopsis

Documentation

embedFun :: Monad m => [(Idx, TyTerm)] -> Expr -> EmFunM m TyTerm

embedFun expr. Returns a type term that represents the |function, if possible.

fullySimplifyFun :: (MonadCatch m, Monad m) => TyTerm -> EmFunM m (TyTerm, [(TyTerm, TyTerm)])

fullySimplify term. Keeps simplifying until no changes are made.

fullySimplifyFuns :: (MonadCatch m, Monad m) => TyTerm -> EmFunM m (TyTerm, [(TyTerm, TyTerm)])

simplifyFuns t. Simplifies all sub terms that are embedded functions. |Calls simplifyFun twice so that after built in functions are expanded, they are applied.

simplifyFunsInEnv :: (MonadCatch m, Monad m) => TyEnv -> EmFunM m (TyEnv, [(TyTerm, TyTerm)])

applyDimGens :: (MonadCatch m, Monad m) => TyTerm -> EmFunM m (TyTerm, [TyConstr], [(TyTerm, TyTerm)])

applyDimGens term. Applies all the dim generators that can be applied |in the current term, returning any new constraints created by the application.

applyDimGensInEnv :: (MonadCatch m, Monad m) => TyEnv -> EmFunM m (TyEnv, [TyConstr], [(TyTerm, TyTerm)])

applyDimGensInEnv env. Applies all dim generators in the env, and |returns any constraints that they create.

getIdxTreeTy :: String -> (TyTerm, TyTerm) -> IntMap TyTerm

getIdxTreeTy (idxTerm, ty). Returns an environment mapping var idxs to type terms.

getVarTreeTy :: String -> IntMap TyTerm -> TyTerm -> TyTerm

getVarTreeTy env term. Returns the type of term by looking up the types of vars in env, and |composing tuples of these together. NOTE: Will fail if more than just simple tuples of vars, |e.g. if it includes a function application!

getSimpleFunTy :: String -> TyTerm -> TyTerm -> TyTerm

getSimpleFunTy domTy funTerm. Returns the type of funTerm given |the domain type domTy, assuming funTerm is a simple tuple proj permute function.

unembedFun :: Monad m => IntMap Expr -> TyTerm -> IdxMonad m (Maybe Expr)

unembedFun term. Returns a function expr for the type |term, if this term if a function term.

evalEmFunM :: Monad m => EmFunM m r -> IntMap Expr -> IntMap TySchemeEx -> IdxMonad m r

isFunTerm :: TyTerm -> Bool

isFunTerm term. Returns true if the term is an embedded function.

areValidFuns :: [Idx] -> TyTerm -> Bool

areValidFuns term. Returns true if term is an embedded lambda |with args that are just tuples of vars. Also checks to make sure |that Vars (not VVars) and bound inside an FLet or an FFun.

fromFBoth :: TyTerm -> [TyTerm]

fromBoth term. If term is an FBoth returns list of it's children |otherwise returns singleton list containing term.