Module Main

The main module of currypp, the Curry Preprocessor

The Curry Preprocessor transforms the source code of Curry programs. Currently, only the translation of foreign code integrated in Curry code is supported (option foreigncode, see module Translator).

Author: Michael Hanus

Version: January 2021

Summary of exported operations:

cppBanner :: String  Deterministic 
parseTarget :: String -> Maybe PPTarget  Deterministic 
initOpts :: PPOpts  Deterministic 
main :: IO ()  Non-deterministic 
The main function of the Curry Preprocessor.
processOptions :: PPOpts -> [String] -> Maybe PPOpts  Deterministic 
showUsage :: [String] -> IO ()  Deterministic 
usageText :: String  Deterministic 
preprocess :: PPOpts -> String -> String -> String -> String -> IO ()  Non-deterministic 
callPreprocessors :: PPOpts -> String -> String -> String -> String -> IO String  Non-deterministic 
pathToModName :: String -> String -> String  Deterministic 
Transforms a file path name for a module back into a hierarchical module since only the file path of a module is passed to the preprocessor.
replaceOptionsLine :: String -> String  Deterministic 
isOptionLine :: String -> Bool  Deterministic 
optionLines :: String -> String  Deterministic 

Exported datatypes:


PPTarget

Preprocessor targets, i.e., kind of entities to be preprocessed:

Constructors:

  • ForeignCode :: PPTarget
  • DefaultRules :: PPTarget
  • Contracts :: PPTarget

PPOpts

Preprocessor options:

Constructors:

  • PPOpts :: Bool -> Bool -> Int -> [PPTarget] -> String -> [String] -> [String] -> PPOpts

    Fields:

    • optHelp :: Bool
    • optSave :: Bool
    • optVerb :: Int
    • optTgts :: [PPTarget]
    • optModel :: String
    • optDefRules :: [String]
    • optContracts :: [String]

Exported operations:

cppBanner :: String  Deterministic 

parseTarget :: String -> Maybe PPTarget  Deterministic 

initOpts :: PPOpts  Deterministic 

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

main :: IO ()  Non-deterministic 

The main function of the Curry Preprocessor.

processOptions :: PPOpts -> [String] -> Maybe PPOpts  Deterministic 

showUsage :: [String] -> IO ()  Deterministic 

usageText :: String  Deterministic 

preprocess :: PPOpts -> String -> String -> String -> String -> IO ()  Non-deterministic 

callPreprocessors :: PPOpts -> String -> String -> String -> String -> IO String  Non-deterministic 

pathToModName :: String -> String -> String  Deterministic 

Transforms a file path name for a module back into a hierarchical module since only the file path of a module is passed to the preprocessor. This is done only if it is a local file path name, otherwise it is difficult to reconstruct the original module name from the file path.

replaceOptionsLine :: String -> String  Deterministic 

isOptionLine :: String -> Bool  Deterministic 

optionLines :: String -> String  Deterministic