package bonsai

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

Module Uri_parsing.Value_parserSource

This module contains primitive parsers. Not useful on their own, but when combined with the parsers in the Parser module they become useful.

Sourcetype 'a t

A 'a Value_parser.t will parse string -> 'a and unparse 'a -> string

Sourceval int : int t
Sourceval string : string t
Sourceval float : float t
Sourceval bool : bool t
Sourceval stringable : (module Core.Stringable with type t = 'a) -> 'a t
Sourceval sexpable : (module Core.Sexpable with type t = 'a) -> 'a t
Sourceval binable_via_base64 : (module Core.Bin_prot.Binable.S with type t = 'a) -> 'a t
Sourceval base64_encoded : 'a t -> 'a t

base64_encoded will decode the URL component before parsing, and encode the URL component after unparsing.

Sourceval project : 'a t -> parse_exn:('a -> 'b) -> unparse:('b -> 'a) -> 'b t

Turns a parser of type 'a to a parser of type 'b.

Properties:

  • If the parse_exn function fails, so does the entire parser.
Sourceval fallback : 'a t -> fallback:'a -> 'a t

fallback parser value parses into value every time that parser fails.

Sourceval name : string -> 'a t -> 'a t

Displays a different name when shown in url. e.g. instead of:

  project (fallback string)

appearing as "/?q=<project<fallback<string>>>"

you could do:

  name "username" (project (fallback string))

and it would appear as "/?q=<username>"

OCaml

Innovation. Community. Security.