fun add x =
let
fun add' y = x + y
in
add' 1 + add' 2
end
fun f (x : int) =
let
fun page () = return
{[x]}
in
page
end
fun f (x : int) =
let
fun page1 () = return
{[x]}
and page2 () =
case Some True of
Some r => return {[r]}
| _ => return Error
in
page1
end
datatype list t = Nil | Cons of t * list t
fun length (t ::: Type) (ls : list t) =
let
fun length' ls acc =
case ls of
Nil => acc
| Cons (_, ls') => length' ls' (acc + 1)
in
length' ls 0
end