package core

  1. Overview
  2. No Docs
Industrial strength alternative to OCaml's standard library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.17.1.tar.gz
md5=743a141234e04210e295980f7a78a6d9
sha512=61b415f4fb12c78d30649fff1aabe3a475eea926ce6edb7774031f4dc7f37ea51f5d9337ead6ec73cd93da5fd1ed0f2738c210c71ebc8fe9d7f6135a06bd176f

doc/core/Core/Ordering/index.html

Module Core.OrderingSource

Extends Base.Ordering, intended to make code that matches on the result of a comparison more concise and easier to read.

Sourcetype t = Base.Ordering.t =
  1. | Less
  2. | Equal
  3. | Greater
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
Sourceval bin_size_t : t Bin_prot.Size.sizer
Sourceval bin_write_t : t Bin_prot.Write.writer
Sourceval bin_read_t : t Bin_prot.Read.reader
Sourceval __bin_read_t__ : (int -> t) Bin_prot.Read.reader

This function only needs implementation if t exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t afterwards.

Sourceval bin_shape_t : Bin_prot.Shape.t
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_hash_lib.Hashable.S with type t := t
include Sexplib0.Sexpable.S with type t := t
Sourceval compare : t -> t -> int
Sourceval compare__local : t -> t -> int
Sourceval hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
include Sexplib0.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval t_sexp_grammar : t Sexplib0.Sexp_grammar.t
Sourceval all : t list
include Base.Equal.S with type t := t
Sourceval equal__local : t -> t -> bool
Sourceval of_int : int -> t

of_int n is:

  Less     if n < 0
  Equal    if n = 0
  Greater  if n > 0
Sourceval to_int : t -> int

to_int t is:

  Less     -> -1
  Equal    -> 0
  Greater  -> 1

It can be useful when writing a comparison function to allow one to return Ordering.t values and transform them to ints later.