query
On this page

mkMaybe

lib.gvariant.mkMaybe

Docs pulled from | This Revision | about 1 hour ago


Returns the GVariant maybe from the given element type.

Inputs

elemType

1. Function argument

elem

2. Function argument

Type

mkMaybe :: gvariant.type -> Any -> gvariant

Noogle detected

Implementation

The following is the current implementation of this function.

mkMaybe =
    elemType: elem:
    mkPrimitive (type.maybeOf elemType) elem
    // {
      __toString =
        self: if self.value == null then "@${self.type} nothing" else "just ${toString self.value}";
    };