Module "CompactFlatCurry.curry"

This module contains functions to reduce the size of FlatCurry programs by combining the main module and all imports into a single program that contains only the functions directly or indirectly called from a set of main functions.

Author: Michael Hanus, Carsten Heine

Version: January 2007


 Exported names:

Datatypes:
Option | RequiredSpec

Constructors:
Exports | Import | InitFuncs | Main | Required | Verbose

Functions:
alwaysRequired | computeCompactFlatCurry | defaultRequired | generateCompactFlatCurryFile | requires


 Summary of exported functions:

requires  :: (String,String) -> (String,String) -> RequiredSpec  deterministic 
          (fun `requires` reqfun) specifies that the use of the function "fun" implies the application of function "reqfun".
alwaysRequired  :: (String,String) -> RequiredSpec  deterministic 
          (alwaysRequired fun) specifies that the function "fun" should be always present if the corresponding module is loaded.
defaultRequired  :: [RequiredSpec]  deterministic 
          Functions that are implicitly required in a FlatCurry program (since they might be generated by external functions like "==" or "=:=" on the fly).
generateCompactFlatCurryFile  :: [Option] -> String -> String -> IO ()  deterministic 
          Computes a single FlatCurry program containing all functions potentially called from a set of main functions and writes it into a FlatCurry file.
computeCompactFlatCurry  :: [Option] -> String -> IO Prog  deterministic rigid
          Computes a single FlatCurry program containing all functions potentially called from a set of main functions.

 Imported modules:

Directory
Distribution
FileGoodies
FlatCurry
List
Maybe
Prelude
RedBlackTree
SetRBT
Sort
TableRBT
Time
XML

 Exported datatypes:

Option

Options to guide the compactification process.

Constructors:

Verbose :: Option

Verbose - for more output

Main :: String -> Option

Main - optimize for one main (unqualified!) function supplied here

Exports :: Option

Exports - optimize w.r.t. the exported functions of the module only

InitFuncs :: [(String,String)] -> Option

InitFuncs - optimize w.r.t. given list of initially required functions

Required :: [RequiredSpec] -> Option

Required - list of functions that are implicitly required and, thus, should not be deleted if the corresponding module is imported

Import :: String -> Option

Import - module that should always be imported (useful in combination with option InitFuncs)


RequiredSpec

Data type to specify requirements of functions.

Constructors:



 Exported functions:

requires :: (String,String) -> (String,String) -> RequiredSpec  deterministic 

(fun `requires` reqfun) specifies that the use of the function "fun" implies the application of function "reqfun".

Further infos:
  • defined as non-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

alwaysRequired :: (String,String) -> RequiredSpec  deterministic 

(alwaysRequired fun) specifies that the function "fun" should be always present if the corresponding module is loaded.

Further infos:
  • solution complete, i.e., able to compute all solutions

defaultRequired :: [RequiredSpec]  deterministic 

Functions that are implicitly required in a FlatCurry program (since they might be generated by external functions like "==" or "=:=" on the fly).

Further infos:
  • solution complete, i.e., able to compute all solutions

generateCompactFlatCurryFile :: [Option] -> String -> String -> IO ()  deterministic 

Computes a single FlatCurry program containing all functions potentially called from a set of main functions and writes it into a FlatCurry file. This is done by merging all imported FlatCurry modules and removing the imported functions that are definitely not used.

Example call:  (generateCompactFlatCurryFile options source target)

Parameters:
options - list of options
source - name of the FlatCurry file (without suffix .fcy) that should be optimized
target - the target where the compact program is saved (without

computeCompactFlatCurry :: [Option] -> String -> IO Prog  deterministic rigid

Computes a single FlatCurry program containing all functions potentially called from a set of main functions. This is done by merging all imported FlatCurry modules (these are loaded demand-driven so that modules that contains no potentially called functions are not loaded) and removing the imported functions that are definitely not used.

Example call:  (computeCompactFlatCurry options source)

Parameters:
options - list of options
source - name of the FlatCurry file (without suffix .fcy) that should be optimized
Returns:
the compact FlatCurry program


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:40:44 2008