curry.toolchain.flat2icurry.elimnewtype module
Newtype elimination, the first pass. It follows FlatCurry.ElimNewtype
of the Curry package flatcurry.
For a declaration newtype T a = C te:
The declaration becomes a data declaration with one unary constructor.
A type
T tbecomestewithareplaced byt. Operations named_inst#...keep their types.A constructor application
C ebecomese.A partial application
Cbecomes the partialPrelude.id.A case
case x of C y -> ebecomesewithyreplaced byx, or aLetwhen the scrutinee is not a variable.
The newtypes come from the module and from the interfaces of its imports.
- curry.toolchain.flat2icurry.elimnewtype.elim_newtype(impprogs, prog)[source]
Eliminates the newtypes of
prog.impprogsare its imports.