Skip to content

Commit f1f67e1

Browse files
committed
Merge pull request #124 from ocsigen/xmlsvgwrapped
Make Svg wrapped function API similar to Html.
2 parents 29c6532 + 9f27ab1 commit f1f67e1

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

lib/svg_f.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ let string_of_paint = function
106106
module Make_with_wrapped_functions
107107

108108
(Xml : Xml_sigs.T)
109-
(C : Svg_sigs.Wrapped_functions
110-
with type ('a, 'b) ft = ('a, 'b) Xml.W.ft) =
109+
(C : Svg_sigs.Wrapped_functions with module Xml = Xml) =
111110

112111
struct
113112

@@ -915,9 +914,11 @@ struct
915914

916915
end
917916

918-
module Wrapped_functions = struct
917+
module Wrapped_functions
918+
(Xml : Xml_sigs.T with type ('a,'b) W.ft = 'a -> 'b) =
919+
struct
919920

920-
type (-'a, 'b) ft = 'a -> 'b
921+
module Xml = Xml
921922

922923
let string_of_alignment_baseline = function
923924
| `Auto -> "auto"
@@ -1120,4 +1121,4 @@ end
11201121

11211122
module Make
11221123
(Xml : Xml_sigs.T with type ('a, 'b) W.ft = ('a -> 'b)) =
1123-
Make_with_wrapped_functions(Xml)(Wrapped_functions)
1124+
Make_with_wrapped_functions(Xml)(Wrapped_functions(Xml))

lib/svg_f.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ module Make(Xml : Xml_sigs.T with type ('a, 'b) W.ft = ('a -> 'b))
9292
and type +'a attrib = Xml.attrib
9393

9494
(** The standard set of wrapped functions, when [W.ft] is the regular function. *)
95-
module Wrapped_functions :
96-
Svg_sigs.Wrapped_functions with type (-'a, 'b) ft = 'a -> 'b
95+
module Wrapped_functions
96+
(Xml: Xml_sigs.T with type ('a, 'b) W.ft = 'a -> 'b)
97+
: Svg_sigs.Wrapped_functions with module Xml = Xml
9798

9899
(** Similar to {!Make} but with a custom set of wrapped functions. *)
99100
module Make_with_wrapped_functions
100101
(Xml : Xml_sigs.T)
101-
(C : Svg_sigs.Wrapped_functions
102-
with type (-'a, 'b) ft = ('a, 'b) Xml.W.ft)
102+
(C : Svg_sigs.Wrapped_functions with module Xml = Xml)
103103
: Svg_sigs.Make(Xml).T
104104
with type +'a elt = Xml.elt
105105
and type +'a attrib = Xml.attrib

lib/svg_sigs.mli

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -968,49 +968,49 @@ end
968968
(** Wrapped functions, to be used with {!Svg_f.Make_with_wrapped_functions}. *)
969969
module type Wrapped_functions = sig
970970

971-
type (-'a, 'b) ft
971+
module Xml : Xml_sigs.T
972972

973973
val string_of_alignment_baseline :
974-
([< Svg_types.alignment_baseline], string) ft
974+
([< Svg_types.alignment_baseline], string) Xml.W.ft
975975

976-
val string_of_bool : (bool, string) ft
976+
val string_of_bool : (bool, string) Xml.W.ft
977977

978-
val string_of_big_variant : ([< Svg_types.big_variant], string) ft
978+
val string_of_big_variant : ([< Svg_types.big_variant], string) Xml.W.ft
979979

980-
val string_of_coords : (Svg_types.coords, string) ft
980+
val string_of_coords : (Svg_types.coords, string) Xml.W.ft
981981

982982
val string_of_dominant_baseline :
983-
([< Svg_types.dominant_baseline], string) ft
983+
([< Svg_types.dominant_baseline], string) Xml.W.ft
984984

985-
val string_of_fourfloats : (float * float * float * float, string) ft
985+
val string_of_fourfloats : (float * float * float * float, string) Xml.W.ft
986986

987-
val string_of_in_value : ([< Svg_types.in_value], string) ft
987+
val string_of_in_value : ([< Svg_types.in_value], string) Xml.W.ft
988988

989-
val string_of_int : (int, string) ft
989+
val string_of_int : (int, string) Xml.W.ft
990990

991-
val string_of_length : (Svg_types.Unit.length, string) ft
991+
val string_of_length : (Svg_types.Unit.length, string) Xml.W.ft
992992

993-
val string_of_lengths : (Svg_types.lengths, string) ft
993+
val string_of_lengths : (Svg_types.lengths, string) Xml.W.ft
994994

995-
val string_of_number : (float, string) ft
995+
val string_of_number : (float, string) Xml.W.ft
996996

997997
val string_of_number_optional_number :
998-
(float * float option, string) ft
998+
(float * float option, string) Xml.W.ft
999999

1000-
val string_of_numbers : (float list, string) ft
1000+
val string_of_numbers : (float list, string) Xml.W.ft
10011001

1002-
val string_of_numbers_semicolon : (float list, string) ft
1002+
val string_of_numbers_semicolon : (float list, string) Xml.W.ft
10031003

1004-
val string_of_offset : ([< Svg_types.offset], string) ft
1004+
val string_of_offset : ([< Svg_types.offset], string) Xml.W.ft
10051005

1006-
val string_of_orient : (Svg_types.Unit.angle option, string) ft
1006+
val string_of_orient : (Svg_types.Unit.angle option, string) Xml.W.ft
10071007

1008-
val string_of_paint : ([< Svg_types.paint], string) ft
1008+
val string_of_paint : ([< Svg_types.paint], string) Xml.W.ft
10091009

1010-
val string_of_strokedasharray : (Svg_types.lengths, string) ft
1010+
val string_of_strokedasharray : (Svg_types.lengths, string) Xml.W.ft
10111011

1012-
val string_of_transform : (Svg_types.transform, string) ft
1012+
val string_of_transform : (Svg_types.transform, string) Xml.W.ft
10131013

1014-
val string_of_transforms : (Svg_types.transforms, string) ft
1014+
val string_of_transforms : (Svg_types.transforms, string) Xml.W.ft
10151015

10161016
end

0 commit comments

Comments
 (0)