package ocaml-protoc-plugin

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

Module Ocaml_protoc_plugin.ResultSource

Sourcetype error = [
  1. | `Premature_end_of_input
  2. | `Unknown_field_type of int
  3. | `Wrong_field_type of string * string
  4. | `Illegal_value of string * Field.t
  5. | `Unknown_enum_value of int
  6. | `Unknown_enum_name of string
  7. | `Required_field_missing of int * string
]
Sourceexception Error of error
Sourcetype 'a t = ('a, error) result
Sourceval raise : error -> 'a

Raise error as an exception of type Result.Error

Sourceval catch : (unit -> 'a) -> ('a, [> error ]) result

catch f catches any exception of type Result.Error raised and returns a result type

Sourceval (>>|) : 'a t -> ('a -> 'b) -> 'b t

Monadic map

Sourceval (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadoc bind

Sourceval return : 'a -> 'a t

Monadic return

Sourceval fail : error -> 'a t

Create the error state

Sourceval get : msg:string -> 'a t -> 'a

Get the value or fail with the given message

Sourceval pp_error : Format.formatter -> error -> unit

Pretty printer of the error type

Sourceval show_error : error -> string

Create a string representation of error

Sourceval pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> ('a, [< error ]) result -> unit

Prettyprinter

OCaml

Innovation. Community. Security.