tablecloth icon indicating copy to clipboard operation
tablecloth copied to clipboard

Add Option.thenAlso

Open Dean177 opened this issue 5 years ago • 0 comments

Sample implemenetation

  (* If a is some, then apply fn to a, return both a and the result.
    if either a or b is none, then return none
  *)
  let thenAlso (a : 'a option) ~(f : 'a -> 'b option) : ('a * 'b) option =
    let b = andThen ~f a in
    pair a b

Dean177 avatar Jun 18 '20 19:06 Dean177