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: September 2021
requires
:: (String,String) -> (String,String) -> RequiredSpec
(fun requires
reqfun) specifies that the use of the function "fun"
implies the application of function "reqfun".
|
alwaysRequired
:: (String,String) -> RequiredSpec
(alwaysRequired fun) specifies that the function "fun" should be always present if the corresponding module is loaded. |
defaultRequired
:: [RequiredSpec]
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 ()
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
Computes a single FlatCurry program containing all functions potentially called from a set of main functions. |
Options to guide the compactification process.
Constructors:
Verbose
:: Option
: for more output
Main
:: String -> Option
: optimize for one main (unqualified!) function supplied here
Exports
:: Option
: optimize w.r.t. the exported functions of the module only
InitFuncs
:: [QName] -> Option
: optimize w.r.t. given list of initially required functions
Required
:: [RequiredSpec] -> Option
: list of functions that are implicitly required and, thus,
should not be deleted if the corresponding module
is imported
Import
:: String -> Option
: module that should always be imported
(useful in combination with option InitFuncs)
Data type to specify requirements of functions.
Constructors:
(fun
|
(alwaysRequired fun) specifies that the function "fun" should be always present if the corresponding module is loaded.
|
Functions that are implicitly required in a FlatCurry program (since they might be generated by external functions like "==" or "=:=" on the fly).
|
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.
|
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.
|