package containers

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

Source file CCChar.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(* This file is free software, part of containers. See file "license" for more details. *)

(** {1 Utils around char}

    @since 0.14 *)

include Char

let pp_buf = Buffer.add_char
let pp = Format.pp_print_char

let of_int_exn = Char.chr
let of_int c = try Some (of_int_exn c) with Invalid_argument _ -> None
let to_int = Char.code

(*$=
  (Some 'a') (of_int (to_int 'a'))
  None (of_int 257)
*)

let to_string c = String.make 1 c

(*$Q to_string
  (Q.string_of_size (Q.Gen.return 1)) (fun s -> CCShims_.Stdlib.(=) (to_string s.[0]) s)
*)

module Infix = struct
  let (=) : t -> t -> bool = CCShims_.Stdlib.(=)
  let (<>) : t -> t -> bool = CCShims_.Stdlib.(<>)
  let (<) : t -> t -> bool = CCShims_.Stdlib.(<)
  let (>) : t -> t -> bool = CCShims_.Stdlib.(>)
  let (<=) : t -> t -> bool = CCShims_.Stdlib.(<=)
  let (>=) : t -> t -> bool = CCShims_.Stdlib.(>=)
end
include Infix
OCaml

Innovation. Community. Security.