File tree Expand file tree Collapse file tree 3 files changed +57
-5
lines changed Expand file tree Collapse file tree 3 files changed +57
-5
lines changed Original file line number Diff line number Diff line change @@ -343,8 +343,34 @@ let printPolyVarIdent txt =
343
343
)
344
344
| Otyp_arrow _ as typ ->
345
345
printOutArrowType ~uncurried: false typ
346
- | Otyp_module (_modName , _stringList , _outTypes ) ->
347
- Doc. nil
346
+ | Otyp_module (modName , stringList , outTypes ) ->
347
+ let packageTypeDoc = match (stringList, outTypes) with
348
+ | [] , [] -> Doc. nil
349
+ | labels , types ->
350
+ let i = ref 0 in
351
+ let package = Doc. join ~sep: Doc. line (List. map2 (fun lbl typ ->
352
+ Doc. concat [
353
+ Doc. text (if i.contents > 0 then " and " else " with " );
354
+ Doc. text lbl;
355
+ Doc. text " = " ;
356
+ printOutTypeDoc typ;
357
+ ]
358
+ ) labels types)
359
+ in
360
+ Doc. indent (
361
+ Doc. concat [
362
+ Doc. line;
363
+ package
364
+ ]
365
+ )
366
+ in
367
+ Doc. concat [
368
+ Doc. text " module" ;
369
+ Doc. lparen;
370
+ Doc. text modName;
371
+ packageTypeDoc;
372
+ Doc. rparen;
373
+ ]
348
374
349
375
and printOutArrowType ~uncurried typ =
350
376
let (typArgs, typ) = collectArrowArgs typ [] in
@@ -598,8 +624,8 @@ let printPolyVarIdent txt =
598
624
Doc. text " =" ;
599
625
Doc. line;
600
626
Doc. group (
601
- Doc. join ~sep: Doc. line (List. map (fun prim ->
602
- let prim = if prim <> " " && (prim.[0 ] [@ doesNotRaise]) = '\132' then " #rescript-external" else prim in
627
+ Doc. join ~sep: Doc. line (List. map (fun prim ->
628
+ let prim = if prim <> " " && (prim.[0 ] [@ doesNotRaise]) = '\132' then " #rescript-external" else prim in
603
629
(* not display those garbage '\132' is a magic number for marshal *)
604
630
Doc. text (" \" " ^ prim ^ " \" " )) primitives)
605
631
)
Original file line number Diff line number Diff line change @@ -440,4 +440,11 @@ type dotdotObjectCoordinate<'a> = 'a
440
440
}
441
441
type permissions = [#644 | #777]
442
442
type numericPolyVarWithPayload = [#1(string) | #2(int, string)]
443
- let numericPolyVarMatch: [> #1(string) | #2(int, string)]
443
+ let numericPolyVarMatch: [> #1(string) | #2(int, string)]
444
+ let sort: (module(Set.S with elt = 'a), list<'a>) => list<'a>
445
+ let make_set: (('a, 'a) => int) => module(Set.S with elt = 'a)
446
+ type picture = string
447
+ module type DEVICE = {
448
+ let draw: picture => unit
449
+ }
450
+ let devices: Hashtbl.t<string, module(DEVICE)>
Original file line number Diff line number Diff line change @@ -294,3 +294,22 @@ type permissions = [
294
294
| # 777 => # 1 ("payload" )
295
295
| # 644 => # 2 (42 , "test" )
296
296
}
297
+
298
+ let sort = (type s , module (Set : Set .S with type elt = s ), l ) =>
299
+ Set .elements (List .fold_right (Set .add , l , Set .empty ))
300
+
301
+ let make_set = (type s , cmp ) => {
302
+ module S = Set .Make ({
303
+ type t = s
304
+ let compare = cmp
305
+ })
306
+ module (S : Set .S with type elt = s )
307
+ }
308
+
309
+ type picture = string
310
+
311
+ module type DEVICE = {
312
+ let draw : picture => unit
313
+ }
314
+
315
+ let devices : Hashtbl .t <string , module (DEVICE )> = Hashtbl .create (17 )
You can’t perform that action at this time.
0 commit comments