You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
578 B
24 lines
578 B
5 years ago
|
(*
|
||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*)
|
||
|
|
||
5 years ago
|
open! NS0
|
||
5 years ago
|
include Core.Option
|
||
5 years ago
|
|
||
|
let pp fmt pp_elt fs = function
|
||
|
| Some x -> Format.fprintf fs fmt pp_elt x
|
||
|
| None -> ()
|
||
|
|
||
5 years ago
|
let or_else ~f = function None -> f () | o -> o
|
||
5 years ago
|
let cons xo xs = match xo with Some x -> x :: xs | None -> xs
|
||
|
|
||
|
module Monad_syntax = struct
|
||
|
let ( let+ ) x f = map ~f x
|
||
|
let ( and+ ) x y = both x y
|
||
|
let ( let* ) x f = bind ~f x
|
||
|
let ( and* ) x y = both x y
|
||
|
end
|