[Libguestfs] [PATCH 0/4]: mllib: Add 'may' function, and refactoring.

Richard W.M. Jones rjones at redhat.com
Tue Nov 10 20:39:29 UTC 2015


On Tue, Nov 10, 2015 at 08:25:54PM +0000, Richard W.M. Jones wrote:
> The 'may' function is a higher-order function (HOF) that replaces:
> 
>   match x with
>   | None -> ()
>   | Some x -> f x
> 
> with:
> 
>   may f x

Another possibility is to break from lablgtk and call the
function 'maybe', as in:

  g#set_trace trace;
  g#set_verbose verbose;
  maybe g#set_identifier identifier;

?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list