コード例 #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