package aws

  1. Overview
  2. Docs

This module contains various helpers used in generated code.

val drop_empty : (string * 'a) list -> (string * 'a) list

Filters an association list, dropping any pairs where the key is the empty string.

val or_error : 'a option -> 'b -> [ `Ok of 'a | `Error of 'b ]

If input is Some a, produces `Ok a, else produces `Error b.

val of_option : 'a -> 'a option -> 'a

Produces the default if the option is None, else the value.

val of_option_exn : 'a option -> 'a

Produces a if Some a, else throws Failure.

val list_find : ('a * 'b) list -> 'a -> 'b option

Looks for key 'a in association list, producing None if it isn't there.

val list_filter_opt : 'a option list -> 'a list

Returns list of values that were Some v.

val option_bind : 'a option -> ('a -> 'b option) -> 'b option

If a is Some a, applies function. Else, produce None.

val option_map : 'a option -> ('a -> 'b) -> 'b option

Applies function to value is Some, else just produce None.

val option_all : 'a option list -> 'a list option

If all values in list are Some v, produce Some (list_filter_opt list), else produce None.


Innovation. Community. Security.