This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,15 @@
1.5 (17/02/2020)
----------------
- Make Result an alias of Stdlib.Result on OCaml >= 4.08.
1.4 (27/03/2019)
----------------
- Switch to Dune.
- Do not refer to Pervasives; it is deprecated.
1.3 (05/02/2018)
----------------
- Switch to jbuilder.

View file

@ -0,0 +1,24 @@
Copyright (c) 2015, Jane Street Group, LLC <opensource@janestreet.com>
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.

View file

@ -0,0 +1,17 @@
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
default:
dune build @install
install:
dune install $(INSTALL_ARGS)
uninstall:
dune uninstall $(INSTALL_ARGS)
reinstall: uninstall reinstall
clean:
dune clean
.PHONY: default install uninstall reinstall clean

View file

@ -0,0 +1,5 @@
Compatibility 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.

12
unikernel/duniverse/result/dune Executable file
View file

@ -0,0 +1,12 @@
(library
(name result)
(public_name result)
(modules result))
(rule
(with-stdout-to
selected
(run %{ocaml} %{dep:which_result.ml} %{ocaml_version})))
(rule
(copy# %{read:selected} result.ml))

View file

@ -0,0 +1,3 @@
(lang dune 1.0)
(name result)
(version 1.5)

View file

@ -0,0 +1,2 @@
include Stdlib.Result
type ('a, 'b) result = ('a, 'b) Stdlib.Result.t = Ok of 'a | Error of 'b

View file

@ -0,0 +1,2 @@
type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b
type ('a, 'b) t = ('a, 'b) result

View file

@ -0,0 +1,2 @@
type ('a, 'b) result = Ok of 'a | Error of 'b
type ('a, 'b) t = ('a, 'b) result

View file

@ -0,0 +1,18 @@
version: "1.5"
opam-version: "2.0"
maintainer: "opensource@janestreet.com"
authors: ["Jane Street Group, LLC <opensource@janestreet.com>"]
homepage: "https://github.com/janestreet/result"
dev-repo: "git+https://github.com/janestreet/result.git"
bug-reports: "https://github.com/janestreet/result/issues"
license: "BSD-3-Clause"
build: [["dune" "build" "-p" name "-j" jobs]]
depends: [
"ocaml"
"dune" {>= "1.0"}
]
synopsis: "Compatibility Result module"
description: """
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."""

View file

@ -0,0 +1,14 @@
let () =
let version =
Scanf.sscanf Sys.argv.(1) "%d.%d" (fun major minor -> (major, minor))
in
let file =
if version < (4, 03) then
"result-as-newtype.ml"
else
if version < (4, 08) then
"result-as-alias.ml"
else
"result-as-alias-4.08.ml"
in
print_string file