[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Error handling in Mirage - request for comments!



> I would however replace all the network codes with a generic
> (`Network_error of exn), where the exn might be e.g. a Refused
> exception with more information about why it was refused. This makes
> it easy for callers who don't care to handle them all at once (with
> Lwt.fail) ...

Just a small note, in case you weren't aware of the feature. If you want
to easily match on a group of polymorphic variant tags you can use the
`#` pattern syntax. For example, if we have a type with lots of variants:

  type lots_of_varaints = [`A | `B | `C | .....  | `Z ]

and we want to match on the specific subset `A, `B or `C, then we can
name that subset and use the `#typ` pattern syntax:

  type abc = [`A | `B | `C]

  let foo = function
    | #abc -> print_string "It was `A, `B or `C"
    | _ -> print_string "It was something else"

Regards,

Leo

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.