Maybe package:haskell-gi-base

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error. The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.
If the passed in Maybe GError is not Nothing, store a copy in the passed in pointer, unless the pointer is nullPtr.
Like withManagedPtr, but accepts a Maybe type. If the passed value is Nothing the inner action will be executed with a nullPtr argument.
Check if the pointer is nullPtr, and wrap it on a Maybe accordingly.
Like maybe, but for actions on a monad, and with slightly different argument order.
If given a pointer to the memory location, free the FunPtr at that location, and then the pointer itself. Useful for freeing the memory associated to callbacks which are called just once, with no destroy notification.
Convert a Maybe value into a corresponding GVariant of maybe type.
Try to decode a maybe GVariant into the corresponding Maybe type. If the conversion is successful this returns Just x, where x itself is of Maybe type. So, in particular, Just Nothing indicates a successful call, and means that the GVariant of maybe type was empty.