| Author : Michael Hanus, Carsten Heine Version: September 2021
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.
data Option
Options to guide the compactification process.
Constructors:
Verbose
:: Option
Main
:: String -> Option
Exports
:: Option
InitFuncs
:: [QName] -> Option
Required
:: [RequiredSpec] -> Option
Import
:: String -> Option
Known instances:
data RequiredSpec
Data type to specify requirements of functions.
Known instances:
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. This is done by merging all imported FlatCurry modules and removing the imported functions that are definitely not used.
:: [Option]
|
list of options |
-> String
|
name of the Curry program that should be compacted |
-> String
|
name of the target file where the compact program is saved |
-> IO ()
|
computeCompactFlatCurry
:: [Option] -> String -> IO Prog
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.
:: [Option]
|
list of options |
-> String
|
name of the Curry program that should be compacted |
-> IO Prog
|
the compact FlatCurry program |