File: sharing.sml

package info (click to toggle)
mlton 20130715-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 60,900 kB
  • ctags: 69,386
  • sloc: xml: 34,418; ansic: 17,399; lisp: 2,879; makefile: 1,605; sh: 1,254; pascal: 256; python: 143; asm: 97
file content (76 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(* sharing.sml *)

(* Checks treatment of sharing constraints. *)

signature S =
sig
    type t
    type s = t
    sharing type t = s
end;

signature T =   (* from SML/NJ doc *)
sig
    type s
    structure A :
    sig
        datatype d = D of s
        datatype t = K
    end
    sharing type s = A.t
end;

(* Check that multiple sharing equations is all pairs. *)
signature S =
   sig
      structure T: sig end
      structure U: sig type t = int end
      sharing T = U
   end

functor F (structure A: sig type t end
           structure B: sig end
           structure C: sig type t end
           sharing A = B = C) =
   struct
      val _: A.t -> C.t = fn x => x
   end

(* Check that sharing doesn't mistakenly share structures that only differ in
 * free flexible tycons.
 *)

signature T =
   sig
      type t
      structure U:
         sig
            val x: t
         end
   end

structure S:
   sig
      structure T1: T
      structure T2: T
      sharing T1.U = T2.U
   end =
   struct
      structure T1 =
         struct
            type t = int
            structure U =
               struct
                  val x = 13
               end
         end
      structure T2 =
         struct
            type t = real
            structure U =
               struct
                  val x = 13.0
               end
         end
   end
;