Module FlatCurry.ElimNewtype

This module contains operations to eliminate definitions and uses of newtype in a FlatCurry program.

If there is a declaration of the form

newtype NTYPE a1...an = NTCONS te

in a Curry program, the following transformations are preformed:

{a1 |-> t1,..., an |-> tn}(te) except for occurrences in instance definitions, i.e., operations named by _inst#.... (Prelude.id). {y |-> x}(e).

Author: Michael Hanus

Version: March 2021

Summary of exported operations:

elimNewtypeInProg :: Prog -> IO Prog  Non-deterministic 
Eliminates all newtype definitions/uses in a FlatCurry program.
elimNewtype :: [Prog] -> Prog -> Prog  Deterministic 
Eliminates all newtype definitions/uses in a FlatCurry program.

Exported operations:

elimNewtypeInProg :: Prog -> IO Prog  Non-deterministic 

Eliminates all newtype definitions/uses in a FlatCurry program. For this purpose, the interfaces of the imported modules are read before performing the transformation.

elimNewtype :: [Prog] -> Prog -> Prog  Deterministic 

Eliminates all newtype definitions/uses in a FlatCurry program. The first argument are the interfaces of the imported modules.