curry-frontend-0.4.2: Lexer, parser, type checker, etc. for the Curry language

Copyright(c) 2005 , Martin Engelke 2011 - 2015, Björn Peemöller 2016 , Jan Tikovsky
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilitynon-portable (DeriveDataTypeable)
Safe HaskellNone
LanguageHaskell2010

Transformations.CaseCompletion

Description

This module expands case branches with missing constructors.

The MCC translates case expressions into the intermediate language representation (IL) without completing them (i.e. without generating case branches for missing contructors), because the intermediate language supports variable patterns for the fallback case. In contrast, the FlatCurry representation of patterns only allows literal and constructor patterns, which requires the expansion default branches to all missing constructors.

This is only necessary for *rigid* case expressions, because any *flexible* case expression with more than one branch and a variable pattern is non-deterministic. In consequence, these overlapping patterns have already been eliminated in the pattern matching compilation process (see module CurryToIL).

To summarize, this module expands all rigid case expressions.

Documentation