cryptol-2.8.0: Cryptol: The Language of Cryptography

Cryptol.Transform.Specialize

Description

Synopsis

# Documentation

A Name should have an entry in the SpecCache iff it is specializable. Each Name starts out with an empty TypesMap.

type SpecT m a = StateT SpecCache (ModuleT m) a Source #

type SpecM a = SpecT IO a Source #

liftSpecT :: Monad m => ModuleT m a -> SpecT m a Source #

modify :: StateM m s => (s -> s) -> m () Source #

Add a where clause to the given expression containing type-specialized versions of all functions called (transitively) by the body of the expression.

withDeclGroups :: [DeclGroup] -> SpecM a -> SpecM (a, [DeclGroup], Map Name (TypesMap Name)) Source #

Add the declarations to the SpecCache, run the given monadic action, and then pull the specialized declarations back out of the SpecCache state. Return the result along with the declarations and a table of names of specialized bindings.

Compute the specialization of EWhere e dgs. A decl within dgs is replicated once for each monomorphic type instance at which it is used; decls not mentioned in e (even monomorphic ones) are simply dropped.

Transform the given declaration groups into a set of monomorphic declarations. All of the original declarations with monomorphic types are kept; additionally the result set includes instantiated versions of polymorphic decls that are referenced by the monomorphic bindings. We also return a map relating generated names to the names from the original declarations.

freshName :: Name -> [Type] -> SpecM Name Source #

Freshen a name by giving it a new unique.

instantiateExpr :: [Type] -> Int -> Expr -> SpecM Expr Source #

Reduce length ts outermost type abstractions and n proof abstractions.

traverseSnd :: Functor f => (b -> f c) -> (a, b) -> f (a, c) Source #