Library
Module
Module type
Parameter
Class
Class type
A shim to mark non-record fields global. "GEL" stands for "Global Even if inside a Local", but is kept short since we'll need this boilerplate a lot.
For example, if you have a list:
type t = string list
and want to make it local, but still keep the strings global, you can write:
type t = string Gel.t list
and it will be so, but with some extra boilerplate when using it.
This is for use with existing types that don't have the desired global_ annotation. If you find yourself reaching for this for a new type you are defining, you can avoid the boilerplate. For example:
type t =
{ global_ foo : string
; bar : int
}
type t =
| Foo of global_ string
| Bar of { global_ foo : string; bar : int }
| Baz of global_ string * int * global_ string
include Bin_prot.Binable.S1 with type 'a t := 'a t
val bin_shape_t : Bin_prot.Shape.t -> Bin_prot.Shape.t
val bin_size_t : ('a, 'a t) Bin_prot.Size.sizer1
val bin_write_t : ('a, 'a t) Bin_prot.Write.writer1
val bin_read_t : ('a, 'a t) Bin_prot.Read.reader1
val __bin_read_t__ : ('a, int -> 'a t) Bin_prot.Read.reader1
val bin_writer_t : ('a, 'a t) Bin_prot.Type_class.S1.writer
val bin_reader_t : ('a, 'a t) Bin_prot.Type_class.S1.reader
val bin_t : ('a, 'a t) Bin_prot.Type_class.S1.t
include Ppx_compare_lib.Comparable.S1 with type 'a t := 'a t
val compare :
'a Base__Ppx_compare_lib.compare ->
'a t Base__Ppx_compare_lib.compare
include Ppx_compare_lib.Equal.S1 with type 'a t := 'a t
val equal : 'a Base__Ppx_compare_lib.equal -> 'a t Base__Ppx_compare_lib.equal
include Ppx_hash_lib.Hashable.S1 with type 'a t := 'a t
val hash_fold_t :
'a Base__Ppx_hash_lib.hash_fold ->
'a t Base__Ppx_hash_lib.hash_fold
val create : 'a -> 'a t
val g : 'a t -> 'a
val drop_some : 'a t Base.option -> 'a Base.option
Removes a Gel.t
from inside an option type with zero runtime cost. This is useful when some other function returns an X.t Gel.t option
, you know X.t
is mode-crossing, and you want to drop the inner Gel.t
without allocating another local option.
val drop_ok : ('a t, 'b) Base.Result.t -> ('a, 'b) Base.Result.t
Like drop_some
, but for the Ok _
branch of a result.
val drop_error : ('a, 'b t) Base.Result.t -> ('a, 'b) Base.Result.t
Like drop_some
, but for the Error _
branch of a result.
val inject_some : 'a Base.option -> 'a t Base.option
Treat an existing global option as a local while maintaining the knowledge that the data inside the option is global. Zero runtime cost.
"Injects some gel between the option and its Some _
case."
val inject_ok : ('a, 'b) Base.Result.t -> ('a t, 'b) Base.Result.t
Like inject_some
, but for the Ok _
case of a result
.
val inject_error : ('a, 'b) Base.Result.t -> ('a, 'b t) Base.Result.t
Like inject_some
, but for the Error _
case of a result
.