Exemplo n.º 1
0
    def __init__(self, value):
        ''' Initialize a new instance of the ConstantGroup

        :param value: The constant value to operate with
        '''
        super(ConstantGroup, self).__init__(**{
            'zero':    value,
            'lift':    combinator.constant(value),
            'plus':    combinator.constant2(value),
            'negate':  combinator.constant(value),
            'minus':   combinator.constant(value),
        })
Exemplo n.º 2
0
 def unit(klass, value):
     return klass(constant(value))
Exemplo n.º 3
0
 def __init__(self, value):
     if not callable(value):
         value = constant(value)
     self.value = value