package goblint

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file gobResult.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(** Open this to use applicative functor/monad syntax for {!result}. *)
module Syntax =
struct
  (* Applicative functor. *)
  let (let+) x f = Result.map f x
  let (and+) x y = match x, y with
    | Ok x, Ok y -> Ok (x, y)
    | Error e, _
    | _, Error e -> Error e

  (* Monad *)
  let (let*) = Result.bind
  let (and*) = (and+)

  let (>>=) = Result.bind
end
OCaml

Innovation. Community. Security.