예제 #1
0
파일: monoid.py 프로젝트: bashwork/common
    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),
        })
예제 #2
0
파일: monads.py 프로젝트: bashwork/common
 def unit(klass, value):
     return klass(constant(value))
예제 #3
0
파일: monads.py 프로젝트: bashwork/common
 def __init__(self, value):
     if not callable(value):
         value = constant(value)
     self.value = value