Pull requests with enhanced documentation, new implementations and new lambda terms to normalize for testing/benchmarking are welcome!
-
Create a new module under
lib/XXX/whereXXXis a high-level approach. Currently we haveDeBruijn,LocallyNamelessorNamed. If your version is a variant of one of these, add your module there. If it is a new approach, make a new directory for it. -
If you want to split your implementation into binding library/client put the library in
lib/Support/. -
Your module must import a value
implof typeLambdaImpl, defined in the moduleUtil.Impl.data LambdaImpl = forall a. NFData a => LambdaImpl { impl_name :: String, -- ^ the name of the module impl_fromLC :: LC IdInt -> a, impl_toLC :: a -> LC IdInt, -- ^ conversion to/from a named representation impl_nf :: a -> a, -- ^ normalization function impl_nfi :: Int -> a -> Stats.M a, -- ^ bounded version of normalization function, for testing -- optional impl_aeq :: a -> a -> Bool -- ^ alpha-equivalence function } -
You can define your own data type to represent lambda calculus terms or use the one (
LC) provided inUtil.Syntax.Lambda. Other modules inlib/Utilandlib/Supportmay be useful for you. -
Don't forget to add your new module(s) to the
lambda-n-ways.cabalfile! -
Import your new module in
lib/Suite.hsand add it to some list of implementations. Update the variableall_implsto refer to the suite that includes yours. -
Test using
stack test lambda-n-ways. The tests that are run are listed intests/Main.hs -
Benchmark using the Makefile.
make normalizewill run the normalization benchmark and produce html output.
-
The
lamssubdirectory contains suites of lambda terms used for benchmarking and testing. Each file contains one or more lambda-calculus expressions and should be accompanyied by a.nfversion containing their normal forms. -
You can automatically generate the .nf version (and the stats) using the functions in
lib/QuickBenchmodule. -
Edit tests/Main.hs and bench/Main.lhs to load your new lambda terms.