1val x = 0
2
3val hello = "hello world"
4
5val id = fn x => x
6
7fun id' x = x
8
9val () = print "hello world\n"
10
11val _ = let
12  val hello = "hello"
13  val world = "world"
14in
15  print (hello ^ " " ^ world ^ "\n")
16end
17
18fun isZero n =
19  if n = 0 then true
20  else false
21
22fun isTrue b =
23  case b of
24    true => true
25  | false => false
26
27exception Bad_value of string
28
29fun isTrue' b =
30  case b of
31    true => true
32  | _    => raise (Bad_value "value is not true!")
33
34val alwaysTrue =
35  isTrue' false handle Bad_value _ => true
36
37datatype myBool = True | False
38
39datatype shape = Square of real | Circle of real | Point
40
41signature FOO = sig
42  val foo : 'a -> 'a
43end
44
45structure Foo :> FOO = struct
46  fun foo x = x
47end
48