Import Upstream version 20180207
[hcoop/debian/mlton.git] / regression / serialize.sml
CommitLineData
7f918cf1
CE
1open MLton
2
3val l = [1, 2, 3, 4]
4
5structure W = Word8
6structure V = Word8Vector
7
8val r = ref 0
9val t = (r, r)
10
11fun pv v = (V.app (fn w => (print(W.toString w); print " ")) v
12 ; print "\n")
13
14fun pr s = (print s; print "\n")
15
16fun pi i = (print(Int.toString i); print " ")
17fun pl l = List.app pi l
18
19fun 'a ds(a: 'a): 'a = deserialize(serialize a)
20val pb = pr o Bool.toString
21
22val _ =
23 (pb(serialize l = serialize l)
24 ; pl(ds l) ; print "\n"
25 ; pb(l = ds l)
26 ; pb(let val t: int ref * int ref = ds t
27 in #1 t = #2 t
28 end)
29 ; pi(ds (fn x => x) 13)
30 ; pi(ds (fn x => x + 1) 14)
31 ; print "\n")