Commits

Anonymous committed ace8611

+ Monoid.ext

Comments (0)

Files changed (1)

    (see Cd_String.String.monoid_concat for example).
  *)
 
+open Cd_Ops;
+
 class t ['a] z p =
   object
     method zero : 'a = z;
     method plus : 'a -> 'a -> 'a = p;
   end
 ;
+
+class ext ['i, 'a, 'o] inj z p proj =
+  object
+    inherit t ['a] z p;
+    method inj : 'i -> 'a = inj;
+    method proj : 'a -> 'o = proj;
+  end
+;
+
+class id_extend ['a] (mon : t 'a) =
+  ext ['a, 'a, 'a] identity mon#zero mon#plus identity
+;