package reason-standard
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
In functions that make heavy use of Result
s placing an
open Result.Infix
Can make code significantly more concise at the expense of placing a greater cognitive burden on future readers.
An operator version of flatMap
Examples
The following examples assume
open Result.Infix
let reciprical (x:float) : (string, float) Standard.Result.t =
if (x = 0.0) then
Error "Divide by zero"
else
Ok (1.0 /. x)
Is in scope.
Ok 4. >>= reciprical = Ok 0.25
Error "Missing number!" >>= reciprical = Error "Missing number!"
Ok 0. >>= reciprical = Error "Divide by zero"
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>