package gel
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module GelSource
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 listand want to make it local, but still keep the strings global, you can write:
type t = string Gel.t listand 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_ stringinclude Ppx_hash_lib.Hashable.S1 with type 'a t := 'a t
val hash_fold_t :
(Base.Hash.state -> 'a -> Base.Hash.state) ->
Base.Hash.state ->
'a t ->
Base.Hash.stateRemoves 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.
Like drop_some, but for the Ok _ branch of a result.
Like drop_some, but for the Error _ branch of a result.
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."
Like inject_some, but for the Ok _ case of a result.
Like inject_some, but for the Error _ case of a result.
Like inject_some, but for the contents of a result.