package note

  1. Overview
  2. Docs

Option events

val on_some : 'a option event -> 'a event

on_some e is e when Some _ occurs:

  • [on_some e]t = Some v if [e]t = Some (Some v)
  • [on_some e]t = None otherwise.

Lifted module

val some : 'a event -> 'a option event

some e is map (fun v -> Some v) e.

val value : 'a option event -> default:'a signal -> 'a event

value e default is default when e occurs with None:

  • [value e ~default]t = None if [e]t = None
  • [value e ~default]t = Some v if [e]t = Some (Some v)
  • [value e ~default]t = [default]t if [e]t = Some None
val get : 'a option event -> 'a event

get e is map get e.

val bind : 'a option event -> ('a -> 'b option) -> 'b option event

bind e f is map (fun v -> Option.bind v f) e.

val join : 'a option option event -> 'a option event

join e is map Option.join e.

val map : ('a -> 'b) -> 'a option event -> 'b option event

map f e is map Option.map e.

val is_none : 'a option event -> bool event

is_none e is map is_none e.

val is_some : 'a option event -> bool event

is_some e is map is_some e.