| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Language.Requirements.Analysis
Description
Analyze a term to discover the requirements for evaluating/executing it.
Note, eventually, requirements will be part of types and requirements analysis will just be part of typechecking (https:/github.comswarm-gameswarmissues/231).
Synopsis
- requirements :: TDCtx -> ReqCtx -> Term -> Requirements
Documentation
requirements :: TDCtx -> ReqCtx -> Term -> Requirements Source #
Infer the requirements to execute/evaluate a term in a given context.
For function application and let-expressions, we assume that the argument (respectively let-bound expression) is used at least once in the body. Doing otherwise would require a much more fine-grained analysis where we differentiate between the capabilities needed to *evaluate* versus *execute* any expression (since e.g. an unused let-binding would still incur the capabilities to *evaluate* it), which does not seem worth it at all.
This is all a bit of a hack at the moment, to be honest; see #231 for a description of a more correct approach.