Module Analysis.Types

This module contains the datatypes, constructors, and other operations to create and process analyses used in the generic analysis system.

Each analysis has a name which is used to identify the analysis stored in files, when passing analysis information between workers etc.

Important: Use the constructor operations to define new analyses (instead of the data constructors).

Author: Heiko Hoffmann, Michael Hanus

Version: June 2018

Summary of exported operations:

simpleFuncAnalysis :: String -> (FuncDecl -> a) -> Analysis a  Deterministic 
A simple analysis for functions takes an operation that computes some information from a given function declaration.
simpleTypeAnalysis :: String -> (TypeDecl -> a) -> Analysis a  Deterministic 
A simple analysis for types takes an operation that computes some information from a given type declaration.
simpleConstructorAnalysis :: String -> (ConsDecl -> TypeDecl -> a) -> Analysis a  Deterministic 
A simple analysis for data constructors takes an operation that computes some information for a constructor declaration and its type declaration to which it belongs.
dependencyFuncAnalysis :: String -> a -> (FuncDecl -> [((String,String),a)] -> a) -> Analysis a  Deterministic 
Construct a function analysis with dependencies.
dependencyTypeAnalysis :: String -> a -> (TypeDecl -> [((String,String),a)] -> a) -> Analysis a  Deterministic 
Construct a type analysis with dependencies.
combinedSimpleFuncAnalysis :: Read a => String -> Analysis a -> (ProgInfo a -> FuncDecl -> b) -> Analysis b  Non-deterministic 
A simple combined analysis for functions.
combined2SimpleFuncAnalysis :: (Read a, Read b) => String -> Analysis a -> Analysis b -> (ProgInfo a -> ProgInfo b -> FuncDecl -> c) -> Analysis c  Non-deterministic 
A simple combined analysis for functions.
combinedSimpleTypeAnalysis :: Read a => String -> Analysis a -> (ProgInfo a -> TypeDecl -> b) -> Analysis b  Non-deterministic 
A simple combined analysis for types.
combinedDependencyFuncAnalysis :: Read a => String -> Analysis a -> b -> (ProgInfo a -> FuncDecl -> [((String,String),b)] -> b) -> Analysis b  Non-deterministic 
A combined analysis for functions with dependencies.
combinedDependencyTypeAnalysis :: Read a => String -> Analysis a -> b -> (ProgInfo a -> TypeDecl -> [((String,String),b)] -> b) -> Analysis b  Non-deterministic 
A combined analysis for types with dependencies.
simpleModuleAnalysis :: String -> (Prog -> a) -> Analysis a  Deterministic 
Construct a simple analysis for entire modules.
dependencyModuleAnalysis :: String -> (Prog -> [(String,a)] -> a) -> Analysis a  Deterministic 
Construct a module analysis which uses analysis information on imported modules.
isSimpleAnalysis :: Analysis a -> Bool  Deterministic 
Is the analysis a simple analysis? Otherwise, it is a dependency analysis which requires a fixpoint computation to compute the results.
isCombinedAnalysis :: Analysis a -> Bool  Deterministic 
Is the analysis a combined analysis?
isFunctionAnalysis :: Analysis a -> Bool  Deterministic 
Is the analysis a function analysis? Otherwise, it is a type or constructor analysis.
analysisName :: Analysis a -> String  Deterministic 
Name of the analysis to be used in server communication and analysis files.
baseAnalysisNames :: Analysis a -> [String]  Deterministic 
Names of the base analyses of a combined analysis.
startValue :: Analysis a -> a  Deterministic 
Start value of a dependency analysis.

Exported datatypes:


Analysis

Datatype representing a program analysis to be used in the generic analysis system. The datatype is abstract so that one has to use one of the constructor operations to create an analysis.

Constructors:

  • SimpleFuncAnalysis :: String -> (FuncDecl -> a) -> Analysis a
  • SimpleTypeAnalysis :: String -> (TypeDecl -> a) -> Analysis a
  • SimpleConstructorAnalysis :: String -> (ConsDecl -> TypeDecl -> a) -> Analysis a
  • DependencyFuncAnalysis :: String -> a -> (FuncDecl -> [(QName,a)] -> a) -> Analysis a
  • DependencyTypeAnalysis :: String -> a -> (TypeDecl -> [(QName,a)] -> a) -> Analysis a
  • CombinedSimpleFuncAnalysis :: [String] -> String -> Bool -> (String -> IO (FuncDecl -> a)) -> Analysis a
  • CombinedSimpleTypeAnalysis :: [String] -> String -> Bool -> (String -> IO (TypeDecl -> a)) -> Analysis a
  • CombinedDependencyFuncAnalysis :: [String] -> String -> Bool -> a -> (String -> IO (FuncDecl -> [(QName,a)] -> a)) -> Analysis a
  • CombinedDependencyTypeAnalysis :: [String] -> String -> Bool -> a -> (String -> IO (TypeDecl -> [(QName,a)] -> a)) -> Analysis a
  • SimpleModuleAnalysis :: String -> (Prog -> a) -> Analysis a
  • DependencyModuleAnalysis :: String -> (Prog -> [(String,a)] -> a) -> Analysis a

AOutFormat

The desired kind of output of an analysis result. AText denotes a standard textual representation. ANote denotes a short note that is empty in case of irrelevant information. For instance, this is used in the CurryBrowser to get a quick overview of the analysis results of all operations in a module.

Constructors:

  • AText :: AOutFormat
  • ANote :: AOutFormat

Exported operations:

simpleFuncAnalysis :: String -> (FuncDecl -> a) -> Analysis a  Deterministic 

A simple analysis for functions takes an operation that computes some information from a given function declaration.

Further infos:
  • solution complete, i.e., able to compute all solutions

simpleTypeAnalysis :: String -> (TypeDecl -> a) -> Analysis a  Deterministic 

A simple analysis for types takes an operation that computes some information from a given type declaration.

Further infos:
  • solution complete, i.e., able to compute all solutions

simpleConstructorAnalysis :: String -> (ConsDecl -> TypeDecl -> a) -> Analysis a  Deterministic 

A simple analysis for data constructors takes an operation that computes some information for a constructor declaration and its type declaration to which it belongs.

Further infos:
  • solution complete, i.e., able to compute all solutions

dependencyFuncAnalysis :: String -> a -> (FuncDecl -> [((String,String),a)] -> a) -> Analysis a  Deterministic 

Construct a function analysis with dependencies. The analysis has a name, a start value (representing "no initial information") and an operation to process a function declaration with analysis information for the operations directly called in this function declaration. The analysis will be performed by a fixpoint iteration starting with the given start value.

Further infos:
  • solution complete, i.e., able to compute all solutions

dependencyTypeAnalysis :: String -> a -> (TypeDecl -> [((String,String),a)] -> a) -> Analysis a  Deterministic 

Construct a type analysis with dependencies. The analysis has a name, a start value (representing "no initial information") and an operation to process a type declaration with analysis information for the type constructors occurring in the type declaration. The analysis will be performed by a fixpoint iteration starting with the given start value.

Further infos:
  • solution complete, i.e., able to compute all solutions

combinedSimpleFuncAnalysis :: Read a => String -> Analysis a -> (ProgInfo a -> FuncDecl -> b) -> Analysis b  Non-deterministic 

A simple combined analysis for functions. The analysis is based on an operation that computes some information from a given function declaration and information provided by some base analysis. The base analysis is provided as the second argument.

combined2SimpleFuncAnalysis :: (Read a, Read b) => String -> Analysis a -> Analysis b -> (ProgInfo a -> ProgInfo b -> FuncDecl -> c) -> Analysis c  Non-deterministic 

A simple combined analysis for functions. The analysis is based on an operation that computes some information from a given function declaration and information provided by two base analyses. The base analyses are provided as the second and third argument.

combinedSimpleTypeAnalysis :: Read a => String -> Analysis a -> (ProgInfo a -> TypeDecl -> b) -> Analysis b  Non-deterministic 

A simple combined analysis for types. The analysis is based on an operation that computes some information from a given type declaration and information provided by some base analysis. The base analysis is provided as the second argument.

combinedDependencyFuncAnalysis :: Read a => String -> Analysis a -> b -> (ProgInfo a -> FuncDecl -> [((String,String),b)] -> b) -> Analysis b  Non-deterministic 

A combined analysis for functions with dependencies. The analysis is based on an operation that computes from information provided by some base analysis for each function declaration and information about its directly called operation some information for the declared function. The analysis will be performed by a fixpoint iteration starting with the given start value (fourth argument). The base analysis is provided as the second argument.

combinedDependencyTypeAnalysis :: Read a => String -> Analysis a -> b -> (ProgInfo a -> TypeDecl -> [((String,String),b)] -> b) -> Analysis b  Non-deterministic 

A combined analysis for types with dependencies. The analysis is based on an operation that computes from information provided by some base analysis for each type declaration and information about its directly used types some information for the declared type. The analysis will be performed by a fixpoint iteration starting with the given start value (fourth argument). The base analysis is provided as the second argument.

simpleModuleAnalysis :: String -> (Prog -> a) -> Analysis a  Deterministic 

Construct a simple analysis for entire modules. The analysis has a name and takes an operation that computes some information from a given module.

Further infos:
  • solution complete, i.e., able to compute all solutions

dependencyModuleAnalysis :: String -> (Prog -> [(String,a)] -> a) -> Analysis a  Deterministic 

Construct a module analysis which uses analysis information on imported modules. The analysis has a name and an operation to analyze a module. The analysis operation could use already computed information of imported modules, represented as a list of module name/information pairs. Note that a fixpoint iteration is not necessary since module dependencies must be acyclic.

Further infos:
  • solution complete, i.e., able to compute all solutions

isSimpleAnalysis :: Analysis a -> Bool  Deterministic 

Is the analysis a simple analysis? Otherwise, it is a dependency analysis which requires a fixpoint computation to compute the results.

isCombinedAnalysis :: Analysis a -> Bool  Deterministic 

Is the analysis a combined analysis?

isFunctionAnalysis :: Analysis a -> Bool  Deterministic 

Is the analysis a function analysis? Otherwise, it is a type or constructor analysis.

analysisName :: Analysis a -> String  Deterministic 

Name of the analysis to be used in server communication and analysis files.

Further infos:
  • solution complete, i.e., able to compute all solutions

baseAnalysisNames :: Analysis a -> [String]  Deterministic 

Names of the base analyses of a combined analysis.

startValue :: Analysis a -> a  Deterministic 

Start value of a dependency analysis.