Clean up crazy state-future-result-monad-we-must-go-deeper tangle
Summary:
This cleans up a crazy state-future-result-monad double wrapping that was
hard to reason about. In making it "more obviously correct" I remove
an unintuitive use of join (move it from "the types don't match so I'll
just use join" into a "I am joining because clearly I'm double-wrapping
the monad via try-with), an uncessary use of lift, and gratuitous closures
created just to satisfy the monadic interface.
In short, I change the type from
(unit -> unit -> (Relative_path.Set.t * 'a, exn) Result.t, exn) Result.t
to
(unit -> (unit -> Relative_path.Set.t * 'a, exn) Result.t, exn) Result.t
Note the second function is contained within the inner result, since it only
makes sense if the first stage of computation succeeds anyways.
No functional changes.
Reviewed By: oulgen
Differential Revision:
D4151057
fbshipit-source-id:
b6e053ab8aad922453dacda8b4086ba5ebc9c4b2