package aws

  1. Overview
  2. Docs

Module Aws.UtilSource

This module contains various helpers used in generated code.

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

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

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

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

Sourceval of_option : 'a -> 'a option -> 'a

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

Sourceval of_option_exn : 'a option -> 'a

Produces a if Some a, else throws Failure.

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

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

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

Returns list of values that were Some v.

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

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

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

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

Sourceval 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.