This module contains an implementation of case completion, i.e.,
all case expressions occurring in a FlatCurry program are completed
(with calls to Prelude.failed) and ordered according to the
constructor ordering of the corresponding data definitions.
type DataDecl
= (QName, [(QName, Int)])
Type to represent algebraic data declarations (pair of type name and list of constructor names and arities).
data CaseOptions
Options for case completion.
Constructors:
typeOfConstructor
:: CaseOptions -> (String, String) -> ((String, String), [((String, String), Int)])
completeProg
:: CaseOptions -> Prog -> Prog
Complete all nested cases in a FlatCurry program.
completeFun
:: CaseOptions -> FuncDecl -> FuncDecl
Complete all nested cases in a FlatCurry function.
completeRule
:: CaseOptions -> Rule -> Rule
completeExp
:: CaseOptions -> Expr -> Expr
allConsProg
:: Prog -> [(String, String)]
Get all constructors occurring in case expressions in a FlatCurry program.
allConsFun
:: FuncDecl -> [(String, String)]
AllCons all nested cases in a FlatCurry function.
allConsExp
:: Expr -> [(String, String)]
unionMap
:: Eq b => (a -> [b]) -> [a] -> [b]
dataDeclsOf
:: Prog -> [((String, String), [((String, String), Int)])]
Get all data types (pairs of type name and list of constructor names and arities) in a given FlatCurry program.