Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / regression / serialize.sml
1 open MLton
2
3 val l = [1, 2, 3, 4]
4
5 structure W = Word8
6 structure V = Word8Vector
7
8 val r = ref 0
9 val t = (r, r)
10
11 fun pv v = (V.app (fn w => (print(W.toString w); print " ")) v
12 ; print "\n")
13
14 fun pr s = (print s; print "\n")
15
16 fun pi i = (print(Int.toString i); print " ")
17 fun pl l = List.app pi l
18
19 fun 'a ds(a: 'a): 'a = deserialize(serialize a)
20 val pb = pr o Bool.toString
21
22 val _ =
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")