Something went wrong. Try again.
Something went wrong. Try again.
622 B · 31 lines
OCaml
at main
1234567891011121314151617181920212223242526272829303132module type Monoid = sig type t val empty : t val append : t -> t -> tend
module type MonoidHom = sig module S : Monoid module T : Monoid val hom : S.t -> T.tend
module String_monoid : Monoid with type t = string = struct type t = string let empty = "" let append = ( ^ )end
module Int_additive_monoid : Monoid with type t = int = struct type t = int let empty = 0 let append = ( + )end
module String_length_hom : MonoidHom with module S = String_monoid and module T = Int_additive_monoid =struct module S = String_monoid module T = Int_additive_monoid let hom = String.lengthend