Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Result.InfixIn functions that make heavy use of Results placing an
open Result.InfixCan 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.25Error "Missing number!" >>= reciprical = Error "Missing number!"Ok 0. >>= reciprical = Error "Divide by zero"