from tryp.maybe import Empty, Maybe


class Boolean(object):

    def __init__(self, value: bool) -> None:
        self.value = bool(value)

    @staticmethod
    def wrap(value):
        return Boolean(value)

    def maybe(self, value):
        return Maybe(value) if self else Empty()

    def flat_maybe(self, value: Maybe):
        return value if self else Empty()

    def __nonzero__(self):
        return self.value

    def __bool__(self):
        return self.value

    def __str__(self):
        return '{}({})'.format(self.__class__.__name__, self.value)

    __repr__ = __str__

__all__ = ['Boolean']

@@ -6,22 +6,16 @@
 tryp
-.maybe
  import 
 Empt
@@ -14,16 +14,9 @@
 ort 
-Empty, M
+m
 aybe
@@ -234,16 +234,22 @@
  return 
+maybe.
 Maybe(va
@@ -258,32 +258,38 @@
 e) if self else 
+maybe.
 Empty()%0A%0A    def
@@ -313,21 +313,29 @@
  value: 
+'maybe.
 Maybe
+'
 ):%0A     
@@ -363,16 +363,22 @@
 lf else 
+maybe.
 Empty()%0A

use module-only import to avoid cycles