File: Test058.ML

package info (click to toggle)
polyml 5.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 40,616 kB
  • sloc: cpp: 44,142; ansic: 26,963; sh: 22,002; asm: 13,486; makefile: 602; exp: 525; python: 253; awk: 91
file content (56 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (5)
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
(* include must copy values, exceptions and, with the latest changes, value constructors. *)
signature S1 =
    sig
    val x : int
    type t
    datatype s = A | B of t | C of int
    val y : int
    end;

signature S2 =
    sig
    val a: int
    include S1
    val b : int
    end;

functor F(Q: S2) =
struct
    fun f (Q.A) = Q.x
      | f (Q.B _) = Q.b
      | f (Q.C i) = i
    datatype s = datatype Q.s
end;

structure P = F(struct val x = 1; type t = bool datatype s = A | B of t | C of int;
                    val y = 3; val a = 4 val b = 5 end);
if P.f(P.A) = 1
then ()
else raise Fail "WRONG";

signature S2 =
    sig
    val a: int
    include
        sig
        val x : int
        type t
        datatype s = A | B of t | C of int
        val y : int
        end
    val b : int
    end;
    
functor F(Q: S2) =
struct
    fun f (Q.A) = Q.x
      | f (Q.B _) = Q.b
      | f (Q.C i) = i
    datatype s = datatype Q.s
end;

structure P = F(struct val x = 1; type t = bool datatype s = A | B of t | C of int;
                    val y = 3; val a = 4 val b = 5 end);
if P.f(P.A) = 1
then ()
else raise Fail "WRONG";