pax_global_header00006660000000000000000000000064126660534650014527gustar00rootroot0000000000000052 comment=46f46269fb137822dbb714b20af32bdf5b621a11 result-1.2/000077500000000000000000000000001266605346500127075ustar00rootroot00000000000000result-1.2/LICENSE000066400000000000000000000030001266605346500137050ustar00rootroot00000000000000Copyright (c) 2015, Jane Street Group, LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Jane Street Group nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. result-1.2/META000066400000000000000000000003171266605346500133610ustar00rootroot00000000000000version = "1.0" description = "Result type" archive(byte) = "result.cma" archive(byte, plugin) = "result.cma" archive(native) = "result.cmxa" archive(native, plugin) = "result.cmxs" exists_if = "result.cma" result-1.2/Makefile000066400000000000000000000011771266605346500143550ustar00rootroot00000000000000.PHONY: all all: byte native result.install result.ml: which_result.ml cp `ocaml which_result.ml` result.ml .PHONY: byte byte: result.ml ocamlc -c result.ml ocamlc -a -o result.cma result.cmo .PHONY: native native: result.ml ocamlopt -c result.ml ocamlopt -a -o result.cmxa result.cmx ocamlopt -shared -linkall -o result.cmxs result.cmxa || true result.install: result.cma gen_result_install.ml ocaml gen_result_install.ml .PHONY: install install: ocamlfind remove result 2> /dev/null || true ocamlfind install result META result.* .PHONY: uninstall uninstall: ocamlfind remove result .PHONY: clean clean: rm -f result.* result-1.2/README.md000066400000000000000000000003221266605346500141630ustar00rootroot00000000000000Compatibility Result module. Projects that want to use the new result type defined in OCaml >= 4.03 while staying compatible with older version of OCaml should use the `Result` module defined in this library. result-1.2/gen_result_install.ml000066400000000000000000000010651266605346500171400ustar00rootroot00000000000000let is_prefix s ~prefix = let len = String.length prefix in String.length s >= len && String.sub s 0 len = prefix ;; let () = let install_it = function | "META" -> true | "result.install" -> false | s -> is_prefix s ~prefix:"result." in let to_install = let ( |> ) x f = f x in Sys.readdir "." |> Array.to_list |> List.filter install_it |> List.sort String.compare |> List.map (Printf.sprintf "%S") in let oc = open_out "result.install" in Printf.fprintf oc "lib: [ %s ]\n" (String.concat " " to_install) ;; result-1.2/result-as-alias.ml000066400000000000000000000001131266605346500162420ustar00rootroot00000000000000type ('a, 'b) result = ('a, 'b) Pervasives.result = Ok of 'a | Error of 'b result-1.2/result-as-newtype.ml000066400000000000000000000000561266605346500166520ustar00rootroot00000000000000type ('a, 'b) result = Ok of 'a | Error of 'b result-1.2/which_result.ml000066400000000000000000000003621266605346500157420ustar00rootroot00000000000000let () = let version = Scanf.sscanf Sys.ocaml_version "%d.%d" (fun major minor -> (major, minor)) in let file = if version < (4, 03) then "result-as-newtype.ml" else "result-as-alias.ml" in print_string file