diff --git a/src/stdlib/WebSharper.Main.Proxies/ResultModule.fs b/src/stdlib/WebSharper.Main.Proxies/ResultModule.fs index 26b0a0cf..a0849815 100644 --- a/src/stdlib/WebSharper.Main.Proxies/ResultModule.fs +++ b/src/stdlib/WebSharper.Main.Proxies/ResultModule.fs @@ -24,18 +24,23 @@ FSharp.Core, Culture=neutral, \ PublicKeyToken=b03f5f7f11d50a3a">] module private WebSharper.ResultModuleProxy - + let Bind f r = match r with | Ok x -> f x | Error e -> Error e - + let Map f r = match r with | Ok x -> Ok (f x) | Error e -> Error e - + let MapError f r = match r with | Ok x -> Ok x - | Error e -> Error (f e) + | Error e -> Error (f e) + +let isOk r = + match r with + | Ok _ -> true + | _ -> false \ No newline at end of file diff --git a/tests/WebSharper.Tests/Result.fs b/tests/WebSharper.Tests/Result.fs index c4b1a1f3..e3eb7f36 100644 --- a/tests/WebSharper.Tests/Result.fs +++ b/tests/WebSharper.Tests/Result.fs @@ -57,4 +57,11 @@ let Tests = equal (r2 |> Result.bind (fun x -> Ok())) (Error "e") } + Test "isOk" { + let r = Ok 3 + let r2 = Error "e" + equal (r |> Result.isOk) true + equal (r2 |> Result.isOk) false + } + }