curry.toolchain.flat2icurry.casecompletion module

Case completion, the second pass. It follows FlatCurry.CaseCompletion of the Curry package icurry.

Every case over constructors is rewritten so that its branches follow the constructor order of the data declaration. A missing constructor c of arity n gets the branch c 101 .. 100+n -> Prelude.failed. A case over literals is left as it is. The data declarations come from the module and from the interfaces of its imports.

curry.toolchain.flat2icurry.casecompletion.complete_exp(datadecls, e)[source]

Completes every case in an expression. The walk runs on a stack of its own (utility.trampoline.trampoline()), so a nested application of any depth needs no recursion (issue #125).

curry.toolchain.flat2icurry.casecompletion.complete_prog(datadecls, prog)[source]

Completes every case in a program.

curry.toolchain.flat2icurry.casecompletion.failed_branch(c, ar)[source]

The branch for a constructor the case does not mention.

curry.toolchain.flat2icurry.casecompletion.type_of_constructor(datadecls, qn)[source]

The first data declaration that holds the constructor qn.