5 import StdInt, StdString, StdBool
8 lit :: a -> x a | toString a
9 (+.) infixl 6 :: (x a) (x a) -> x a | + a // integer addition, Boolean OR
10 (*.) infixl 7 :: (x a) (x a) -> x a | * a // integer multiplication, Boolean AND
13 write :: (x Int) -> x Int
15 (XOR) infixr 3 :: (x Bool) (x Bool) -> x Bool
16 -. :: (x Bool) -> x Bool
17 class (=.=) infix 4 x :: (x a) (x a) -> x Bool | == a
20 try :: (x a) (x a) -> x a
22 class aexpr x | arith, store, except, =.= x
23 class bexpr x | arith, truth, except, =.= x
24 class expr x | aexpr, bexpr x
26 :: Step a = Step (State -> (Maybe a, State))
29 /*seven :: e Int | aexpr e
30 seven = lit 3 +. lit 4
32 throw1 :: e Int | expr e
33 throw1 = lit 3 +. throw
36 six = write (lit 3) +. read
38 try1 :: e Int | expr e
39 try1 = try throw1 (lit 42)
41 loge :: e Bool | expr e
42 loge = lit True *. -. (lit True)
44 comp :: e Bool | expr e
45 comp = lit 1 =.= lit 2 XOR -. (-. (lit True))*/