Module FlatCurry.CaseCompletion

Author
Michael Hanus
Version
November 2025

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.

Exported Datatypes


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:


Exported Functions


typeOfConstructor :: CaseOptions -> (String, String) -> ((String, String), [((String, String), Int)])  Deterministic 


completeProg :: CaseOptions -> Prog -> Prog  Deterministic 

Complete all nested cases in a FlatCurry program.


completeFun :: CaseOptions -> FuncDecl -> FuncDecl  Deterministic 

Complete all nested cases in a FlatCurry function.


completeRule :: CaseOptions -> Rule -> Rule  Deterministic 


completeExp :: CaseOptions -> Expr -> Expr  Deterministic 


allConsProg :: Prog -> [(String, String)]  Deterministic 

Get all constructors occurring in case expressions in a FlatCurry program.


allConsFun :: FuncDecl -> [(String, String)]  Deterministic 

AllCons all nested cases in a FlatCurry function.


allConsExp :: Expr -> [(String, String)]  Deterministic 


unionMap :: Eq b => (a -> [b]) -> [a] -> [b]  Deterministic 


dataDeclsOf :: Prog -> [((String, String), [((String, String), Int)])]  Deterministic 

Get all data types (pairs of type name and list of constructor names and arities) in a given FlatCurry program.