Library
Module
Module type
Parameter
Class
Class type
Functional lenses.
Based on F# implementation in FSharpx (see src/FSharpx.Core/Lens.fs for the original implementation)
Lens type definition
val modify : ('a, 'b) t -> ('b -> 'b) -> 'a -> 'a
Updates a value through a lens
Pairs three lenses
Selects a lens checking a predicate.
cond pred lensTrue lensFalse
: pred
is applied to source. If true
, lensTrue
is selected. If false
, lensFalse
is selected.
val get_state : ('a, 'b) t -> 'a -> 'b * 'a
Gets a value from the state monad.
val put_state : ('a, 'b) t -> 'b -> 'a -> unit * 'a
Puts a value in the state monad.
val modify_state : ('a, 'b) t -> ('b -> 'b) -> 'a -> unit * 'a
Modifies a value in the state monad.
val ignore : ('a, unit) t
Trivial lens
val id : ('a, 'a) t
Identity lens
val first : ('a * 'b, 'a) t
Gets/sets the first element in a pair
val second : ('a * 'b, 'b) t
Gets/sets the second element in a pair
val head : ('a list, 'a) t
Gets/sets the first element in a list
val tail : ('a list, 'a list) t
Gets/sets the tail of a list
val for_assoc : 'a -> (('a * 'b) list, 'b option) t
Lens for a particular key in an associative list
val for_array : int -> ('a array, 'a) t
Lens for a particular position in an array
val for_list : int -> ('a list, 'a) t
Lens for a particular position in a list
val option_get : ('a option, 'a) t
Lens for extracting the value from an option type (same as Option.get)
Applies an isomorphism to the value viewed through a lens
module Infix : sig ... end
Infix operators
module StateInfix : sig ... end
Infix operators for the state monad