this repo has no description
1module type Monoid = sig
2 type t
3 val empty : t
4 val append : t -> t -> t
5end
6
7module type MonoidHom = sig
8 module S : Monoid
9 module T : Monoid
10 val hom : S.t -> T.t
11end
12
13module String_monoid : Monoid with type t = string = struct
14 type t = string
15 let empty = ""
16 let append = ( ^ )
17end
18
19module Int_additive_monoid : Monoid with type t = int = struct
20 type t = int
21 let empty = 0
22 let append = ( + )
23end
24
25module String_length_hom :
26 MonoidHom with module S = String_monoid and module T = Int_additive_monoid =
27struct
28 module S = String_monoid
29 module T = Int_additive_monoid
30 let hom = String.length
31end