Пример #1
0
class DiscardL(IO, InfixMix()):
    op = ">>"
    def do(self):
        result = self.left.do()
        if isinstance(result, IOZeroType):
            return result
        return self.right.do()
Пример #2
0
class Bind(IO, InfixMix()):
    op = "&"
    def do(self):
        result = self.left.do()
        if isinstance(result, IOZeroType):
            return result
        return self.right(result).do()
Пример #3
0
class Or(IO, InfixMix()):
    op = "|"
    def do(self):
        result = self.left.do()
        if isinstance(result, IOZeroType):
            return self.right.do()
        return result    
Пример #4
0
class Apply(IO, InfixMix()):
    op = "*"
    def do(self):
        f = self.left.do()
        if isinstance(f, IOZeroType):
            return f
        x = self.right.do()
        if isinstance(x, IOZeroType):
            return x
        return f(x)
Пример #5
0
class ProcessorComposite(Processor, InfixMix()):
    op = ">>"
    __init__ = InfixMix().__init__

    def __call__(self, stream):
        return self.right(self.left(stream))