1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import List(intersperse)
import System
import FlatCurry.Types
import FlatCurry.Files
import FlatCurry.Compact
main = do
args <- getArgs
case args of
[prog] -> compactProgAndReplace [] prog
["-export",prog] -> compactProgAndReplace [Exports] prog
["-main",func,prog] -> compactProgAndReplace [Main func] prog
_ -> putStrLn $ "ERROR: Illegal arguments: " ++
concat (intersperse " " args) ++ "\n" ++
"Usage: curry-compactflat [-export | -main func] <module_name>"
compactProgAndReplace options prog = do
generateCompactFlatCurryFile (Required defaultRequired : options)
prog (prog++"_comp.fcy")
let progfcy = flatCurryFileName prog
system $ "mv "++prog++"_comp.fcy "++progfcy
putStr $ "curry-compactflat: compacted program '"++progfcy++"' written.\n"
|