Module CPP.Contracts

A transformation from a Curry program with pre/postconditions and/or specification into a Curry program where these conditions are integrated into the code as run-time assertions.

The general idea of contracts and this transformation is described in:

S. Antoy, M. Hanus: Contracts and Specifications for Functional Logic Programming Proc. 14th International Symposium on Practical Aspects of Declarative Languages (PADL 2012), pp. 33-47, Springer LNCS 7149, 2012

Author: Michael Hanus

Version: November 2021

Summary of exported operations:

translateContracts :: Int -> [String] -> String -> String -> CurryProg -> IO (Maybe CurryProg)  Non-deterministic 
Execute the contract wrapper in "preprocessor mode".
main :: IO ()  Non-deterministic 

Exported operations:

translateContracts :: Int -> [String] -> String -> String -> CurryProg -> IO (Maybe CurryProg)  Non-deterministic 

Execute the contract wrapper in "preprocessor mode". The Curry program must be read with readCurry (and not readUntypedCurry) in order to correctly process arities based on function types! The result is Nothing if no transformation was applied or Just the transformed program.

main :: IO ()  Non-deterministic