3 (* Deriving a signature with types exposed *)
6 type sum
= S0
| S1
of int | S2
of int * float | S3
of int * float * bool | Sunit
of unit | Stup
of (int * float) | Stup1
of (int)
7 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
9 type nullsum
= N0
| N1
| N2
| N3
10 deriving
(Enum
, Bounded
, Eq
, Typeable
, Pickle
)
15 } deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Functor
)
20 } deriving
(Eq
, Show
, Typeable
, Pickle
)
25 } deriving
(Eq
, Show
, Typeable
, Pickle
)
30 type label
= x
:int -> int
32 type funct
= int -> int
34 type intseq
= INil
| ICons
of int * intseq
35 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Functor
)
37 type 'a seq
= Nil
| Cons
of 'a
* 'a seq
38 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
40 type uses_seqs
= (intseq
* float seq
)
41 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
43 type obj
= < x
: int >
45 type poly0
= [`T0
| `T1
| `T2
| `T3
]
46 deriving
(Enum
, Bounded
, Show
, Eq
, Typeable
, Pickle
)
48 type poly1
= [`T0
| `T1
of int]
49 deriving
(Dump
, Eq
, Show
)
51 type poly2
= P
of int * [`T0
| `T1
of int] * float
52 deriving
(Dump
, Eq
, Show
)
54 type poly3
= [`Nil
| `Cons
of int * 'c
] as 'c
55 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
57 type poly3b
= int * ([`Nil
| `Cons
of int * 'c
] as 'c
) * [`F
]
58 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
60 type 'a poly7
= Foo
of [`F
of 'a
]
61 and 'a poly8
= { x
: [`G
of [`H
of [`I
of 'a poly7
]]] }
62 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
64 type poly10
= [`F
| poly3
]
65 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
67 type mutrec_a
= mutrec_c
68 and mutrec_b
= { l1
: mutrec_c
; l2
: mutrec_a
}
69 and mutrec_c
= S
of int * mutrec_a
| N
70 and mutrec_d
= [`T
of mutrec_b
]
71 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
73 type ('a
,'b
) pmutrec_a
= ('a
,'b
) pmutrec_c
74 and ('a
,'b
) pmutrec_b
= { pl1
: ('a
,'b
) pmutrec_c
; pl2
: ('a
,'b
) pmutrec_a
}
75 and ('a
,'b
) pmutrec_c
= SS
of 'a
* ('a
,'b
) pmutrec_a
* 'b
76 and ('a
,'b
) pmutrec_d
= [`T
of ('a
,'b
) pmutrec_b
]
77 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
79 type 'a ff1
= F
of 'a
* 'a
| G
of int deriving
(Show
, Eq
, Dump
, Functor
, Typeable
, Pickle
)
80 type ('a
,'b
) ff2
= F1
of ('a
,'b
) ff2
| F2
of 'a seq
* int * 'b
option
81 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
84 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
85 type tup2
= int * float
86 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
87 type tup3
= int * float * bool
88 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
89 type tup4
= int * int * bool * unit
90 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Bounded
)
92 type withref
= WR
of int * (int ref)
93 deriving
(Eq
, Show
, Typeable
, Pickle
)
96 type t deriving
(Show
, Eq
, Dump
)
100 type 'a t
(* deriving (Show) *)
103 type 'a constrained
= [`F
of 'a
] constraint 'a
= int
110 type p2
= private Q deriving
(Show
, Eq
, Dump
)
114 deriving
(Eq
, Enum
, Bounded
, Dump
, Show
, Typeable
, Pickle
, Functor
)
118 (* Deriving a signature with types made abstract *)
121 type sum deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
122 type nullsum deriving
(Enum
, Bounded
, Eq
, Typeable
, Pickle
)
123 type r1 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Functor
)
124 type r2 deriving
(Eq
, Show
, Typeable
, Pickle
)
125 type r3 deriving
(Eq
, Show
, Typeable
, Pickle
)
129 type intseq deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Functor
)
130 type 'a seq deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
131 type uses_seqs deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
133 type poly0 deriving
(Enum
, Bounded
, Show
, Eq
, Typeable
, Pickle
)
134 type poly1 deriving
(Dump
, Eq
, Show
)
135 type poly2 deriving
(Dump
, Eq
, Show
)
136 type poly3 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
137 type poly3b deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
139 and 'a poly8 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
140 type poly10 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
144 and mutrec_d deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
145 type ('a
,'b
) pmutrec_a
146 and ('a
,'b
) pmutrec_b
147 and ('a
,'b
) pmutrec_c
148 and ('a
,'b
) pmutrec_d deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
149 type 'a ff1 deriving
(Show
, Eq
, Dump
, Functor
, Typeable
, Pickle
)
150 type ('a
,'b
) ff2 deriving
(Dump
, Eq
, Show
, Functor
, Typeable
, Pickle
)
151 type tup0 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
152 type tup2 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
153 type tup3 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
)
154 type tup4 deriving
(Dump
, Eq
, Show
, Typeable
, Pickle
, Bounded
)
155 type withref deriving
(Eq
, Show
, Typeable
, Pickle
)
156 module M
: sig type t deriving
(Show
, Eq
, Dump
) end
157 module P
: sig type 'a t
end
158 type 'a constrained
constraint 'a
= int deriving
(Functor
)
159 type p1 deriving
(Show
, Eq
)
160 module Private
: sig type p2
end
161 type t deriving
(Eq
, Enum
, Bounded
, Dump
, Show
, Typeable
, Pickle
, Functor
)
166 (* A signature with no deriving (to make sure that the types are still
168 module T_no_deriving
:
170 type sum
= S0
| S1
of int | S2
of int * float | S3
of int * float * bool | Sunit
of unit | Stup
of (int * float) | Stup1
of (int)
172 type nullsum
= N0
| N1
| N2
| N3
192 type label
= x
:int -> int
194 type funct
= int -> int
196 type intseq
= INil
| ICons
of int * intseq
198 type 'a seq
= Nil
| Cons
of 'a
* 'a seq
200 type uses_seqs
= (intseq
* float seq
)
202 type obj
= < x
: int >
204 type poly0
= [`T0
| `T1
| `T2
| `T3
]
206 type poly1
= [`T0
| `T1
of int]
208 type poly2
= P
of int * [`T0
| `T1
of int] * float
210 type poly3
= [`Nil
| `Cons
of int * 'c
] as 'c
212 type poly3b
= int * ([`Nil
| `Cons
of int * 'c
] as 'c
) * [`F
]
214 type 'a poly7
= Foo
of [`F
of 'a
]
215 and 'a poly8
= { x
: [`G
of [`H
of [`I
of 'a poly7
]]] }
217 type poly10
= [`F
| poly3
]
219 type mutrec_a
= mutrec_c
220 and mutrec_b
= { l1
: mutrec_c
; l2
: mutrec_a
}
221 and mutrec_c
= S
of int * mutrec_a
| N
222 and mutrec_d
= [`T
of mutrec_b
]
224 type ('a
,'b
) pmutrec_a
= ('a
,'b
) pmutrec_c
225 and ('a
,'b
) pmutrec_b
= { pl1
: ('a
,'b
) pmutrec_c
; pl2
: ('a
,'b
) pmutrec_a
}
226 and ('a
,'b
) pmutrec_c
= SS
of 'a
* ('a
,'b
) pmutrec_a
* 'b
227 and ('a
,'b
) pmutrec_d
= [`T
of ('a
,'b
) pmutrec_b
]
229 type 'a ff1
= F
of 'a
* 'a
| G
of int
230 type ('a
,'b
) ff2
= F1
of ('a
,'b
) ff2
| F2
of 'a seq
* int * 'b
option
233 type tup2
= int * float
234 type tup3
= int * float * bool
235 type tup4
= int * int * bool * unit
236 type withref
= WR
of int * (int ref)
246 type 'a constrained
= [`F
of 'a
] constraint 'a
= int