package patoline

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

The Data module provides an abstract interface for working with the value of configuration file fields.

exception Mismatch

The exception Mismatch is raised when the user attempts to cast a piece of data to the wrong type using the functions bellow.

type _ atom_type =
  1. | Int : int atom_type
  2. | Float : float atom_type
  3. | String : string atom_type
  4. | Bool : bool atom_type

An enumerated type over the base types used in configuration files.

type t

The type of the value of a configuration file field.

type data = t

Function for injecting OCaml types into the type data.

val of_atom : 'a atom_type -> 'a -> t
val of_list : 'a atom_type -> 'a list -> t
val of_option : 'a atom_type -> 'a option -> t
val of_int : int -> t
val of_float : float -> t
val of_string : string -> t
val of_bool : bool -> t

Function for reading OCaml from the type data. These functions can raise Mismatch if an attempt is made to read an element of data that do not have the right type.

val to_atom : 'a atom_type -> t -> 'a
val to_list : 'a atom_type -> t -> 'a list
val to_option : 'a atom_type -> t -> 'a option
val to_int : t -> int
val to_float : t -> float
val to_string : t -> string
val to_bool : t -> bool
OCaml

Innovation. Community. Security.