[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] Using Result instead of Option in libraries
On Fri, Oct 14, 2016 at 3:23 PM, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
On 14 Oct 2016, at 15:11, Hannes Mehnert <hannes@xxxxxxxxxxx> wrote: They do look useful :)
I'm curious what people recommend here -- I'm certainly open to adopting a common convention even if it involves a bit of churn. Initially I kept minting my own infix operators (like `>>*=` `>>|=`) but it quickly got confusing for me and I probably didn't name them uniformly across projects. Recently I've stuck to `>>=` and have put different ones in different modules like this: ``` module LwtResult = struct let (>>=) m f = end ``` and now my code looks like (sometimes with extra newlines, but I don't have strong opinions about that) ``` let open Lwt.Infix in f () >>= fun () -> let open LwtResult in g () >>= fun () -> Lwt.return (Result.Ok ()) (* possibly should define `return` in the module too *) ``` Part of my rationale for using the same bind was a hope that one day modular implicits might automatically choose the right version and I could lose the `let open` but maybe this isn't possible? Cheers, Dave _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |