Commit 4a2b46c8 authored by Michael Hanus 's avatar Michael Hanus

Documentation extended with one example

parent 4f24076b
......@@ -50,7 +50,7 @@ the file `Prelude.curry` and invoke the following commands:
> kics2-frontend -i "." --typed-flat Prelude
2. Generate `Prelude.icy` (the ICurry representation of the Prelude,
which also generates the ICuury type dependency file `Prelude.ictdeps`):
which also generates the ICurry type dependency file `Prelude.ictdeps`):
> icurry f2i -I ".curry" .curry/Prelude.tfcy .curry/Prelude.icy
......
Compiling example programs
==========================
As mentioned in the README of the package, the current version
of the `icurry` compiler is intended to be invoked by
other build tools. Hence, the direct usage needs
some manual efforts. Thus, we describe below as
an example the direct translation of the example program `Rev.curry`
into the ICurry format.
Assumption:
* $CURRYHOME is defined as the main directory of the Curry implementation
(KiCS2 or PAKCS)
1. Generate the typed FlatCurry files of module `Rev`
(in `.curry/Rev.tfcy`) and the prelude (if PAKCS is used,
replace `kics2` by `pakcs`):
> $CURRYHOME/bin/kics2-frontend -i $CURRYHOME/lib --typed-flat Rev
2. Generate `Prelude.icy` (the ICurry representation of the Prelude,
which also generates the ICurry type dependency file `Prelude.ictdeps`):
> icurry f2i -I $CURRYHOME/lib/.curry $CURRYHOME/lib/.curry/Prelude.tfcy $CURRYHOME/lib/.curry/Prelude.icy
Note that this takes a *lot of time* if `icurry` has been generated
with PAKCS instead of KiCS2!
3. Now one can compile modules using the prelude in the same way.
For instance, to compile module `Rev` in this directory:
> icurry f2i -I .curry -I $CURRYHOME/lib/.curry .curry/Rev.tfcy .curry/Rev.icy
4. If desired, generate the Extended ICurry representation of `Rev`
(in `.curry/Rev.eicy`):
> icurry i2e -I .curry -I $CURRYHOME/lib/.curry .curry/Rev.icy .curry/Rev.eicy
or similarly for the prelude:
> icurry i2e -I $CURRYHOME/lib/.curry $CURRYHOME/lib/.curry/Prelude.icy $CURRYHOME/lib/.curry/Prelude.eicy
----------------------------------------------------------------------------
-- Concatenating two lists:
-- (predefined as `++' in the standard prelude)
append :: [a] -> [a] -> [a]
append [] x = x
append (x:xs) ys = x : append xs ys
-- Reverse the order of elements in a list:
rev :: [a] -> [a]
rev [] = []
rev (x:xs) = append (rev xs) [x]
goal1 :: [Int]
goal1 = append [1,2] [3,4]
goal2 :: [Int]
goal2 = rev [1,2,3,4]
-- end of program
......@@ -2,6 +2,7 @@
"name": "icurry",
"version": "2.0.0",
"author": "Marc Andre Wittorf <stu114055@mail.uni-kiel.de>",
"maintainer": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "Generic intermediate format for compiling Curry to imperative languages",
"category": [ "Metaprogramming" ],
"license": "BSD-3-Clause",
......@@ -14,8 +15,8 @@
"ninja" : ">= 1.0.0"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0",
"kics2": ">= 2.0.0"
"kics2": ">= 2.0.0, < 3.0.0",
"pakcs": ">= 2.0.0, < 3.0.0"
},
"exportedModules": [ "ICurry.Types", "ICurry.Files", "ICurry.Pretty",
"ICurry.C2I", "ICurry.Build",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment