diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Result.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_Result.res index 7ace5c9c..39aad100 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Result.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_Result.res @@ -29,3 +29,10 @@ let getTag = (r: result_<'a, 'e>): int => | Ok(_) => rtOk_ | Error(_) => rtError_ } + +@genType +let fmap = (r: result_<'a, 'e>, f: 'a => 'b): result_<'b, 'e> => + switch r { + | Ok(v) => Ok(f(v)) + | Error(e) => Error(e) + }