Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let opt_err err = function
- | None -> Error err
- | Some x -> Ok x
- let ( let* ) = Result.bind
- let get_post course_id_opt =
- let* course_id = course_id_opt |> opt_err "invalid null course ID" in
- let* post_id = CommonDb.get_post_id course_id |> opt_err
- (sprintf "unable to find post ID for course ID %d and post type '%s'" course_id (post_type ()))
- in
- let* post = get_post post_id |> opt_err
- (sprintf "unable to find post ID %d for post type '%s'" post_id (post_type ()))
- in post
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement