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