result fmap

This commit is contained in:
Umur Ozkul 2022-08-20 06:47:23 +02:00
parent ddb6d7f958
commit feb7627ad0

View File

@ -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)
}