Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 30 lines (21 sloc) 0.716 kb
311e3ca @23Skidoo A basic demo file.
authored
1 module Demo
2 where
3
4ab0a71 @23Skidoo Some examples.
authored
4 import ERP
311e3ca @23Skidoo A basic demo file.
authored
5
e4e7b87 @23Skidoo More comprehensive demo.
authored
6 -- Interpreter.
4ab0a71 @23Skidoo Some examples.
authored
7 simpleApp :: AST
8 simpleApp = (app (lambda (var "x") (var "x")) (int 2))
9
10 simpleStuck :: AST
11 simpleStuck = (var "x")
e4e7b87 @23Skidoo More comprehensive demo.
authored
12
13 -- Typechecker.
14
15 simpleType1 :: AST
16 simpleType1 = (concatStr (str "answer: ") (intToStr (plus (int 35) (int 7))))
17
18 simpleType2 :: AST
19 simpleType2 = (map_ (app (var "plus") (int 64)) (list [(int 1), (int 2)]))
20
21 -- Queries.
22 simpleQuery :: AST
23 simpleQuery = (query [("o", "owners"), ("a", "accounts")]
24 [(intEq (snd_ (var "o")) (fst_ (var "a")))]
25 [(fst_ (var "o")), (snd_ (var "a"))])
26
27 simpleReduce :: AST
28 simpleReduce = (reduce (var "plus") (int 0)
29 (query [("a", "accounts")] [] [(snd_ (var "a"))]))
Something went wrong with that request. Please try again.