示例#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