Commits

Dmitry Grebeniuk  committed 1bc1c22

moved Parvel_Lwt_IO (and some code from other projects) to new dependency 'ocaml_monad_io' (hosted at bitbucket too)

  • Participants
  • Parent commits 58e5166

Comments (0)

Files changed (7)

 name="parvel"
 version=""
 description="Message-passing primitives in Actors-style"
-requires="unix, lwt, lwt.unix"
+requires="unix, lwt, lwt.unix, monad_io, monad_io.lwt"
 archive(byte)="parvel.cma"
 archive(native)="parvel.cmxa"
 
 all :
 	ocamlbuild parvel.cmi parvel_types.cmi parvel_IO.cmi \
-	   parvel_Lwt_IO.cmi \
 	   parvel.cma parvel.cmxa tests.byte tests.native
 
 install : all
 	  $(PKG) META \
 	  _build/parvel.cma _build/parvel.cmxa _build/parvel.a \
 	  parvel.mli \
-	  _build/parvel.cmi _build/parvel_types.cmi _build/parvel_IO.cmi \
-	  _build/parvel_Lwt_IO.cmi
+	  _build/parvel.cmi _build/parvel_types.cmi _build/parvel_IO.cmi
 
 deinstall :
 	ocamlfind remove $(PKG)
-<*.ml> | <*.mli> : camlp4r, pkg_lwt, pkg_lwt.unix
-<*.byte> | <*.native> : pkg_lwt, pkg_lwt.unix
+<*.ml> | <*.mli> | <*.byte> | <*.native> : camlp4r, pkg_lwt, pkg_monad_io.lwt, pkg_lwt.unix
 <*> : warn_A
 <parvel_ops.*> : -camlp4r, camlp4o

File myocamlbuild.ml

        (* on the contrary using After_options will guarantee to have the higher priority *)
 
        (* override default commands by ocamlfind ones *)
+
+(*
        Options.ocamlc     := ocamlfind & A"ocamlc";
+*)
+       Options.ocamlc     := ocamlfind & S[A"ocamlc"; A"-verbose"];
+
        Options.ocamlopt   := ocamlfind & A"ocamlopt";
        Options.ocamldep   := ocamlfind & A"ocamldep" (* S[A"ocamldep"; A"-verbose"] *) ;
        Options.ocamldoc   := ocamlfind & A"ocamldoc";

File parvel.mllib

 Parvel
 Parvel_IO
 Parvel_types
-Parvel_Lwt_IO
 Parvel_ops

File parvel_IO.ml

-include Parvel_Lwt_IO.It_Lwt_IO;
+include IO_Lwt;
 
 module Mq
  :

File parvel_Lwt_IO.ml

-open Parvel_types
-;
-
-(* Lwt IO *)
-
-module It_Lwt_IO
- :
-  sig
-    type m +'a = Lwt.t 'a;
-
-    value return : 'a -> m 'a;
-    value bind : ('a -> m 'b) -> m 'a -> m 'b;
-    value catch : (unit -> m 'a) -> (exn -> m 'a) -> m 'a;
-
-    value error : exn -> m 'a;
-
-    type output_channel = Lwt_io.output_channel;
-    value stdout : output_channel;
-    value write : output_channel -> string -> m unit;
-
-    type input_channel = Lwt_io.input_channel;
-    value open_in : string -> m input_channel;
-    value close_in : input_channel -> m unit;  (* Lwt_io.close inch *)
-    value read_into : input_channel -> string -> int -> int -> m int;
-       (* read_into ic buffer offset length *)
-
-    value runIO : m 'a -> res 'a;
-
-    value with_file_in_bin : string -> (input_channel -> m 'a) -> m 'a;
-    value with_file_out_bin : string -> (output_channel -> m 'a) -> m 'a;
-
-  end
- =
-  struct
-    type m +'a = Lwt.t 'a;
-    value return = Lwt.return;
-    value bind f m = Lwt.bind m f;
-    value ( >>= ) = Lwt.bind;
-
-    value catch = Lwt.catch;
-
-(*
-    value try_bind m f handler =
-      catch (fun () -> m () >>= f) handler
-    ;
-*)
-
-
-    value wrap_exn place = fun e ->
-      Lwt.fail (EIO (e, place))
-    ;
-
-
-    value wrap1 place f = fun a ->
-      catch (fun () -> f a)
-      (wrap_exn place)
-    ;
-
-    value wrap2 place f = fun a b ->
-      catch (fun () -> f a b)
-      (wrap_exn place)
-    ;
-
-    value wrap4 place f = fun a b c d ->
-      catch (fun () -> f a b c d)
-      (wrap_exn place)
-    ;
-
-    value read_into = wrap4 "read_into" Lwt_io.read_into;
-
-    value error = Lwt.fail;
-
-    type output_channel = Lwt_io.output_channel;
-    value stdout = Lwt_io.stdout;
-    value write = wrap2 "write" Lwt_io.write;
-
-    type input_channel = Lwt_io.input_channel;
-
-    value open_in = wrap1 "open_in" (
-      fun fn ->
-(*
-       Lwt.return (
-*)
-        Lwt_io.open_file
-          ~mode:Lwt_io.input
-          ~flags:[Unix.O_RDONLY]
-         fn
-(*
-        )
-*)
-      )
-    ;
-
-    value close_in = wrap1 "close_in" Lwt_io.close;
-
-    value runIO x : res 'a =
-      try `Ok (Lwt_main.run x)
-      with [e -> `Error e]
-    ;
-
-    value with_file_in_bin filename func =
-      Lwt_io.with_file ~mode:Lwt_io.input filename func
-    ;
-
-    value with_file_out_bin filename func =
-      Lwt_io.with_file ~mode:Lwt_io.output filename func
-    ;
-
-  end
-;