Skip to content

Commit

Permalink
Merge pull request #5 from ocurrent/result
Browse files Browse the repository at this point in the history
Do not `open Result` to clean up internal code
  • Loading branch information
avsm authored Feb 20, 2020
2 parents bab1f80 + 1b541e2 commit 312f24d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 52 deletions.
5 changes: 0 additions & 5 deletions .docker-run.sh

This file was deleted.

25 changes: 0 additions & 25 deletions .docker.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Add `unreleased_betas` list to enumerate the latest release-candidate
version for each unreleased minor OCaml series.
* Do not `open Result` to clean up internal code.

## v2.3.0 (2019-08-29)

Expand Down
18 changes: 8 additions & 10 deletions ocaml_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*
*)

open Result

type t = { major: int; minor: int; patch: int option; extra: string option }
let v ?patch ?extra major minor = { major; minor; patch; extra }

Expand Down Expand Up @@ -44,7 +42,7 @@ let parse s =
end

let of_string s =
try Ok (parse s) with
try Result.Ok (parse s) with
| _ -> Error (`Msg (Printf.sprintf "Unable to parse OCaml version '%s'" s))

let of_string_exn s =
Expand Down Expand Up @@ -152,16 +150,16 @@ let string_of_arch = function
| `Ppc64le -> "ppc64le"

let arch_of_string = function
| "arm64" | "aarch64" -> Ok `Aarch64
| "amd64" | "x86_64" -> Ok `X86_64
| "arm32" | "arm32v7" | "aarch32" -> Ok `Aarch32
| "ppc64le" -> Ok `Ppc64le
| arch -> Error (`Msg ("Unknown architecture " ^ arch))
| "arm64" | "aarch64" -> Result.Ok `Aarch64
| "amd64" | "x86_64" -> Result.Ok `X86_64
| "arm32" | "arm32v7" | "aarch32" -> Result.Ok `Aarch32
| "ppc64le" -> Result.Ok `Ppc64le
| arch -> Result.Error (`Msg ("Unknown architecture " ^ arch))

let arch_of_string_exn a =
match arch_of_string a with
| Ok a -> a
| Error (`Msg m) -> raise (Invalid_argument m)
| Result.Ok a -> a
| Result.Error (`Msg m) -> raise (Invalid_argument m)

module Since = struct
let bytes = Releases.v4_03_0
Expand Down

0 comments on commit 312f24d

Please sign in to comment.