('a -> 'b -> 'c) -> Async<Result<'a, 'd>> -> Async<Result<'b, 'd>>
-> Async<Result<'c, 'd>>
getFollowerIds : UserId -> Async<Result<UserId list, exn>>
createPost : CreatePostRequest -> Async<Result<PostId, exn>>
type NotifyNewPostRequest =
{ UserIds : UserId list
NewPostId : PostId }
static member Create userIds newPostsId =
{UserIds = userIds; NewPostId = newPostsId}
let createPostAndGetNotifyRequest (req : CreatePostRequest) =
// Async<Result<UserId list, exn>>
let getFollowersResult = getFollowerIds req.UserId
// Async<Result<PostId, exn>>
let createPostResult = createPost req
// Async<Result<NotifyNewPostRequest, exn>>
let newPostRequestResult =
AsyncResult.map2
NotifyNewPostRequest.Create getFollowersResult createPostResult
// ...