File: sigs.ml

package info (click to toggle)
ocaml-deriving-ocsigen 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 628 kB
  • ctags: 1,159
  • sloc: ml: 6,334; makefile: 63; sh: 18
file content (254 lines) | stat: -rw-r--r-- 7,390 bytes parent folder | download | duplicates (2)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
(* Deriving a signature with types exposed *)
module T :
sig 
  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)
    deriving (Dump, Eq, Show, Typeable, Pickle)

  type nullsum = N0 | N1 | N2 | N3
      deriving (Enum, Bounded, Eq, Typeable, Pickle)

  type r1 = {
    r1_l1 : int;
    r1_l2 : int;
  } deriving (Dump, Eq, Show, Typeable, Pickle, Functor)

  type r2 = {
    mutable r2_l1 : int;
    mutable r2_l2 : int;
  } deriving (Eq, Show, Typeable, Pickle)

  type r3 = {
    r3_l1 : int;
    mutable r3_l2 : int;
  } deriving (Eq, Show, Typeable, Pickle)

  type r4 = {
    r4_l1 : 'a . 'a list
  } 
  type label = x:int -> int

  type funct = int -> int

  type intseq = INil | ICons of int * intseq
    deriving (Dump, Eq, Show, Typeable, Pickle, Functor)

  type 'a seq = Nil | Cons of 'a * 'a seq
    deriving (Dump, Eq, Show, Functor, Typeable, Pickle)

  type uses_seqs = (intseq * float seq) 
      deriving (Dump, Eq, Show, Typeable, Pickle)

  type obj = < x : int >

  type poly0 = [`T0 | `T1 | `T2 | `T3]
      deriving (Enum, Bounded, Show, Eq, Typeable, Pickle)

  type poly1 = [`T0 | `T1 of int]
      deriving (Dump, Eq, Show)

  type poly2 = P of int * [`T0 | `T1 of int] * float
    deriving (Dump, Eq, Show)

  type poly3 = [`Nil | `Cons of int * 'c] as 'c
      deriving (Dump, Eq, Show, Typeable, Pickle) 

  type poly3b = int * ([`Nil | `Cons of int * 'c] as 'c) * [`F]
      deriving (Dump, Eq, Show, Typeable, Pickle) 

  type 'a poly7 = Foo of [`F of 'a]
  and 'a poly8 = { x : [`G of [`H of [`I of 'a poly7]]] }
      deriving (Dump, Eq, Show, Functor, Typeable, Pickle)

  type poly10 = [`F | poly3]
      deriving (Dump, Eq, Show, Functor, Typeable, Pickle)

  type mutrec_a = mutrec_c
  and mutrec_b = { l1 : mutrec_c ; l2 : mutrec_a }
  and mutrec_c = S of int * mutrec_a | N
  and mutrec_d = [`T of mutrec_b]
      deriving (Dump, Eq, Show, Typeable, Pickle)

  type ('a,'b) pmutrec_a = ('a,'b) pmutrec_c
  and ('a,'b) pmutrec_b = { pl1 : ('a,'b) pmutrec_c ; pl2 : ('a,'b) pmutrec_a }
  and ('a,'b) pmutrec_c = SS of 'a * ('a,'b) pmutrec_a * 'b
  and ('a,'b) pmutrec_d = [`T of ('a,'b) pmutrec_b]
      deriving (Dump, Eq, Show, Functor, Typeable, Pickle)

  type 'a ff1 = F of 'a * 'a | G of int deriving (Show, Eq, Dump, Functor, Typeable, Pickle)
  type ('a,'b) ff2 = F1 of ('a,'b) ff2 | F2 of 'a seq * int * 'b option
    deriving (Dump, Eq, Show, Functor, Typeable, Pickle)

  type tup0 = unit
      deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup2 = int * float
      deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup3 = int * float * bool
      deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup4 = int * int * bool * unit
      deriving (Dump, Eq, Show, Typeable, Pickle, Bounded)

  type withref = WR of int * (int ref)
    deriving (Eq, Show, Typeable, Pickle)

  module M : sig 
    type t deriving (Show, Eq, Dump)
  end

  module P : sig 
    type 'a t (* deriving (Show) *)
  end

  type 'a constrained = [`F of 'a] constraint 'a = int
      deriving (Functor) 
      
  type p1 = private P1 
      deriving (Show, Eq)
      
  module Private : sig
    type p2 = private Q deriving (Show, Eq, Dump)
  end
    
  type t = int 
      deriving (Eq, Enum, Bounded, Dump, Show, Typeable, Pickle, Functor)
end
  = Tests_defs

(* Deriving a signature with types made abstract *)
module T_opaque :
sig 
  type sum deriving (Dump, Eq, Show, Typeable, Pickle)
  type nullsum deriving (Enum, Bounded, Eq, Typeable, Pickle)
  type r1 deriving (Dump, Eq, Show, Typeable, Pickle, Functor)
  type r2 deriving (Eq, Show, Typeable, Pickle)
  type r3 deriving (Eq, Show, Typeable, Pickle)
  type r4 
  type label
  type funct
  type intseq deriving (Dump, Eq, Show, Typeable, Pickle, Functor)
  type 'a seq deriving (Dump, Eq, Show, Functor, Typeable, Pickle)
  type uses_seqs deriving (Dump, Eq, Show, Typeable, Pickle)
  type obj
  type poly0 deriving (Enum, Bounded, Show, Eq, Typeable, Pickle)
  type poly1 deriving (Dump, Eq, Show)
  type poly2 deriving (Dump, Eq, Show)
  type poly3 deriving (Dump, Eq, Show, Typeable, Pickle) 
  type poly3b deriving (Dump, Eq, Show, Typeable, Pickle) 
  type 'a poly7 
  and 'a poly8 deriving (Dump, Eq, Show, Functor, Typeable, Pickle)
  type poly10 deriving (Dump, Eq, Show, Functor, Typeable, Pickle)
  type mutrec_a 
  and mutrec_b 
  and mutrec_c 
  and mutrec_d deriving (Dump, Eq, Show, Typeable, Pickle)
  type ('a,'b) pmutrec_a 
  and ('a,'b) pmutrec_b 
  and ('a,'b) pmutrec_c 
  and ('a,'b) pmutrec_d deriving (Dump, Eq, Show, Functor, Typeable, Pickle)
  type 'a ff1 deriving (Show, Eq, Dump, Functor, Typeable, Pickle)
  type ('a,'b) ff2 deriving (Dump, Eq, Show, Functor, Typeable, Pickle)
  type tup0 deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup2 deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup3 deriving (Dump, Eq, Show, Typeable, Pickle)
  type tup4 deriving (Dump, Eq, Show, Typeable, Pickle, Bounded)
  type withref deriving (Eq, Show, Typeable, Pickle)
  module M : sig type t deriving (Show, Eq, Dump) end
  module P : sig type 'a t end
  type 'a constrained constraint 'a = int deriving (Functor) 
  type p1 deriving (Show, Eq)
  module Private : sig type p2 end
  type t deriving (Eq, Enum, Bounded, Dump, Show, Typeable, Pickle, Functor)
end
  = Tests_defs


(* A signature with no deriving (to make sure that the types are still
   compatible) *)
module T_no_deriving :
sig 
  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)

  type nullsum = N0 | N1 | N2 | N3

  type r1 = {
    r1_l1 : int;
    r1_l2 : int;
  } 

  type r2 = {
    mutable r2_l1 : int;
    mutable r2_l2 : int;
  } 

  type r3 = {
    r3_l1 : int;
    mutable r3_l2 : int;
  } 

  type r4 = {
    r4_l1 : 'a . 'a list
  } 
  type label = x:int -> int

  type funct = int -> int

  type intseq = INil | ICons of int * intseq

  type 'a seq = Nil | Cons of 'a * 'a seq

  type uses_seqs = (intseq * float seq) 

  type obj = < x : int >

  type poly0 = [`T0 | `T1 | `T2 | `T3]

  type poly1 = [`T0 | `T1 of int]

  type poly2 = P of int * [`T0 | `T1 of int] * float

  type poly3 = [`Nil | `Cons of int * 'c] as 'c

  type poly3b = int * ([`Nil | `Cons of int * 'c] as 'c) * [`F]

  type 'a poly7 = Foo of [`F of 'a]
  and 'a poly8 = { x : [`G of [`H of [`I of 'a poly7]]] }

  type poly10 = [`F | poly3]

  type mutrec_a = mutrec_c
  and mutrec_b = { l1 : mutrec_c ; l2 : mutrec_a }
  and mutrec_c = S of int * mutrec_a | N
  and mutrec_d = [`T of mutrec_b]

  type ('a,'b) pmutrec_a = ('a,'b) pmutrec_c
  and ('a,'b) pmutrec_b = { pl1 : ('a,'b) pmutrec_c ; pl2 : ('a,'b) pmutrec_a }
  and ('a,'b) pmutrec_c = SS of 'a * ('a,'b) pmutrec_a * 'b
  and ('a,'b) pmutrec_d = [`T of ('a,'b) pmutrec_b]

  type 'a ff1 = F of 'a * 'a | G of int
  type ('a,'b) ff2 = F1 of ('a,'b) ff2 | F2 of 'a seq * int * 'b option

  type tup0 = unit
  type tup2 = int * float
  type tup3 = int * float * bool
  type tup4 = int * int * bool * unit
  type withref = WR of int * (int ref)

  module M : sig 
    type t
  end

  module P : sig 
    type 'a t
  end

  type 'a constrained = [`F of 'a] constraint 'a = int
      
  type p1 = private P1 
      
  module Private : sig
    type p2 = private Q
  end
    
  type t = int 
end
  = Tests_defs