package reason-standard
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Operators for code that works extensively with Option
s.
This module is intended to be open
ed at the top of a block of code (or module) that uses its operators extensively.
let nameToAge = Map.String.ofArray [|
("Ant", 1);
("Bat", 5);
|] in
Option.Infix.(
Map.get nameToAge "Ant" >>= (fun antAge ->
Map.get nameToAge "Bat" >>| (fun batAge ->
Int.absolute(batAge - antAge)
)
)
)
(* Some (4) *)
The operator version of map
Examples
Option.Infix.(Some "desserts" >>| String.reverse) = Some "stressed"
Option.Infix.(None >>| String.reverse) = None
The operator version of flatMap
Examples
Option.Infix.(Some [1, 2, 3] >>= List.head) = Some 1
Option.Infix.(Some [] >>= List.head) = None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>