package hack_parallel

  1. Overview
  2. Docs
Parallel and shared memory library

Install

Dune Dependency

Authors

Maintainers

Sources

1.0.1.tar.gz
md5=ba7c72bc207e326b72e294fc76f6ad2c
sha512=5020d47f97bea2f88e2a40411894d03232a7f2282606926c93c7d4c96d72e94a966be852897a9b16f7e0893ba376512045abb9d93020a7c03c3def4f3d918f8e

doc/hack_parallel.hh_json/Hh_json/Access/index.html

Module Hh_json.AccessSource

Sourcetype keytrace = string list
Sourcetype access_failure =
  1. | Not_an_object of keytrace
    (*

    You can't access keys on a non-object JSON thing.

    *)
  2. | Missing_key_error of string * keytrace
    (*

    The key is missing.

    *)
  3. | Wrong_type_error of keytrace * json_type
    (*

    The key has the wrong type.

    *)

Our type for the result monad. It isn't just the json because it tracks * a history of the keys traversed to arrive at the current point. This helps * produce more informative error states.

Sourceval access_failure_to_string : access_failure -> string
Sourceval return : 'a -> 'a m
Sourceval (>>=) : 'a m -> (('a * keytrace) -> 'b m) -> 'b m
Sourceval counit_with : (access_failure -> 'a) -> 'a m -> 'a

This is a comonad, but we need a little help to deal with failure

Sourceval get_obj : string -> (json * keytrace) -> json m

* The following getters operate on a JSON_Object by accessing keys on it, * and asserting the returned value has the given expected type (types * are asserted by which getter you choose to use). * * Returns Not_an_object if the given JSON object is not a JSON_Object type, * since you can only access keys on those. * * Returns Wrong_type_error if the obtained value is not an object type. * * Returns Missing_key_error if the given key is not found in this object. *

Sourceval get_bool : string -> (json * keytrace) -> bool m
Sourceval get_string : string -> (json * keytrace) -> string m
Sourceval get_number : string -> (json * keytrace) -> string m
Sourceval get_number_int : string -> (json * keytrace) -> int m
Sourceval get_array : string -> (json * keytrace) -> json list m
Sourceval get_val : string -> (json * keytrace) -> json m
OCaml

Innovation. Community. Security.