Safe Haskell | None |
---|---|
Language | Haskell2010 |
Turn CoreHW terms into normalized CoreHW Terms
- runNormalization :: DebugLevel -> Supply -> HashMap TmName (Type, Term) -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> (HashMap TyConName TyCon -> Term -> Term) -> NormalizeSession a -> a
- normalize :: [TmName] -> NormalizeSession (HashMap TmName (Type, Term))
- normalize' :: TmName -> NormalizeSession ([TmName], (TmName, (Type, Term)))
- rewriteExpr :: (String, NormRewrite) -> (String, Term) -> NormalizeSession Term
- checkNonRecursive :: TmName -> HashMap TmName (Type, Term) -> HashMap TmName (Type, Term)
- cleanupGraph :: TmName -> HashMap TmName (Type, Term) -> NormalizeSession (HashMap TmName (Type, Term))
- data CallTree
- mkCallTree :: [TmName] -> HashMap TmName (Type, Term) -> TmName -> CallTree
- stripArgs :: [TmName] -> [Id] -> [Either Term Type] -> Maybe [Either Term Type]
- flattenNode :: CallTree -> NormalizeSession (Either CallTree ((TmName, Term), [CallTree]))
- flattenCallTree :: CallTree -> NormalizeSession CallTree
- callTreeToList :: [TmName] -> CallTree -> ([TmName], [(TmName, (Type, Term))])
Documentation
:: DebugLevel | Level of debug messages to print |
-> Supply | UniqueSupply |
-> HashMap TmName (Type, Term) | Global Binders |
-> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) | Hardcoded Type -> HWType translator |
-> HashMap TyConName TyCon | TyCon cache |
-> (HashMap TyConName TyCon -> Term -> Term) | Hardcoded evaluator (delta-reduction) |
-> NormalizeSession a | NormalizeSession to run |
-> a |
Run a NormalizeSession in a given environment
normalize' :: TmName -> NormalizeSession ([TmName], (TmName, (Type, Term))) Source
:: (String, NormRewrite) | Transformation to apply |
-> (String, Term) | Term to transform |
-> NormalizeSession Term |
Rewrite a term according to the provided transformation
:: TmName | topEntity |
-> HashMap TmName (Type, Term) | List of normalized binders |
-> HashMap TmName (Type, Term) |
Check if the call graph (second argument), starting at the topEnity
(first argument) is non-recursive. Returns the list of normalized terms if
call graph is indeed non-recursive, errors otherwise.
cleanupGraph :: TmName -> HashMap TmName (Type, Term) -> NormalizeSession (HashMap TmName (Type, Term)) Source
Perform general "clean up" of the normalized (non-recursive) function hierarchy. This includes:
- Inlining functions that simply "wrap" another function
flattenNode :: CallTree -> NormalizeSession (Either CallTree ((TmName, Term), [CallTree])) Source