Commits

camlspotter committed c97d21e

better monad functor type

  • Participants
  • Parent commits f041941

Comments (0)

Files changed (6)

 #     linkopts
 #         C library link option (without OCaml -cclib options)    
 #
+#  You can specify MyOCamlPackageExtras before using this function to install files out of the scope of this rule.   
+#
 #  Example::
 #
 #      MyOCamlPackage(foo, alpha beta, $(EMPTY), $(EMPTY))
   CMA=$(library_name).cma
   CMXA=$(library_name).cmxa
 
+  if $(not $(defined MyOCamlPackageExtras))
+      MyOCamlPackageExtras[]=
+      export
+
   CSTUBLIBRARIES=
   if $(not $(equal $(cmodules), $(EMPTY)))
       CSTUBLIBRARIES= dll$(library_name).so lib$(library_name).a 
   # CR jfuruse: I guess we do not need the following
   # export # export the implicit rule above
 
-  .DEFAULT: $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa
+  .DEFAULT: $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(MyOCamlPackageExtras)
 
   $(CMA) $(CMXA) $(library_name).a $(CSTUBLIBRARIES) : $(CSTUBS) $(CMOS) $(CMXS)
       ocamlmklib -verbose -o $(library_name) $(CSTUBS) $(linkopts) $(CMOS) $(CMXS)
   ## install
 
   # CR jfuruse: x.cmi is required if x.mli does not exist!
-  targets[]=META $(glob i, *.mli) $(library_name).cmi $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(library_name).o $(library_name).a $(CSTUBLIBRARIES)
+  targets[]=META $(glob i, *.mli) $(library_name).cmi $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(library_name).o $(library_name).a $(CSTUBLIBRARIES) $(MyOCamlPackageExtras)
 
   if $(OCAML_SPOT)
     targets[]+= $(library_name).spot

File lib/OMakefile

    xformat
    xhashtbl
    xstring
+   xlazy
    phantom
    weaktbl
    spot

File lib/monad.ml

 open Monad_intf
 
-module Make(M:S) : T with type 'a t = 'a M.t = struct
+module Make(M:S) : T with type 'a t := 'a M.t = struct
   include M
 
   let map ~f t = bind t (fun x -> return (f x))
 
 end
 
-module Make2(M:S2) : T2 with type ('a, 'z) t = ('a, 'z) M.t = struct
+module Make2(M:S2) : T2 with type ('a, 'z) t := ('a, 'z) M.t = struct
   include M
 
   let map ~f t = bind t (fun x -> return (f x))

File lib/monad.mli

 open Monad_intf
-module Make(M : S) : T with type 'a t = 'a M.t
-module Make2(M : S2) : T2 with type ('a, 'z) t = ('a, 'z) M.t
+module Make(M : S) : T with type 'a t := 'a M.t
+module Make2(M : S2) : T2 with type ('a, 'z) t := ('a, 'z) M.t

File lib/option.ml

+type 'a t = 'a option
+
 include Monad.Make(struct
   type 'a t = 'a option
 
 end
 module Weaktbl = Weaktbl
 module Phantom = Phantom
+module Lazy = struct
+  include Lazy
+  include Xlazy
+end