package yocaml

  1. Overview
  2. Docs
Core engine of the YOCaml Static Site Generator

Install

dune-project
 Dependency

Authors

Maintainers

Sources

yocaml-2.6.0.tbz
sha256=a006e9d52e520986d4262dfe7bfeba6a381f1423be32409494888d667d14ac73
sha512=8a25f1776e0bcd5e317484b681c67b0d6bb60952f0dd0942f44bf708fb3db03331522b4d8929e09c1926b213003bf14bb148468ddde35add0ad657b4d9237bd1

doc/yocaml/Yocaml/Data/Validation/Infix/index.html

Module Validation.InfixSource

Infix operators are essentially used to compose data validators (unlike binding operators, which are used to compose record validation fragments).

Infix operators are used to trivially compose validators. If you have a complicated set of validation rules, it is advisable to build a dedicated function to avoid making the validation rule complex to read.

Sourceval (&) : ('a -> ('b, 'e) Result.t) -> ('b -> ('c, 'e) Result.t) -> 'a -> ('c, 'e) Result.t

(v1 & v2) x sequentially compose v2 (v1 x), so v1 following by v2. For example : int &> positive &> c.

Sourceval (/) : ('a -> ('b, 'e) Result.t) -> ('a -> ('b, 'e) Result.t) -> 'a -> ('b, 'e) Result.t

(v1 / v2) x perform v1 x and if it fail, performs v2 x.

Sourceval ($) : ('a -> ('b, 'c) Result.t) -> ('b -> 'd) -> 'a -> ('d, 'c) Result.t

(v1 $ f) x perform f on the result of v1 x.

Sourceval ($?) : ('a option, 'b) result -> ('a, 'b) result -> ('a, 'b) result

f $? k is k if f is None or x if f is Some x.

Sourceval ($!) : ('a option, 'b) result -> 'a -> ('a, 'b) result

f $? k is Ok k if f is None or x if f is Some x.

Sourceval (|?) : ('a option, 'b) result -> ('a option, 'b) result -> ('a option, 'b) result

f |? k is k if f is None, f otherwise.