Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type IO<'a> = private IO of (unit -> 'a)
- type IOBuilder () =
- member inline this.Bind (IO x : IO<'a>, f: 'a -> IO<'b>) : IO<'b> =
- f (x ())
- member inline this.Bind (x: IO<'a> list, f: 'a list -> IO<'b>) : IO<'b> =
- f (x |> List.map (fun (IO x) -> x ()))
- member inline this.Delay (f: unit -> IO<'a>) : IO<'a> =
- IO (fun _ -> match f () with | IO x -> x ())
- member inline this.Return (x: 'a) : IO<'a> =
- IO (fun _ -> x)
- member inline this.ReturnFrom (IO x : IO<'a>) : IO<'a> =
- IO (fun _ -> x ())
- let io = IOBuilder ()
- [<RequireQualifiedAccess>]
- module IO =
- let inline run (IO x) = x ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement