Exemple #1
0
class DiscardL(IO, InfixMix()):
    op = ">>"
    def do(self):
        result = self.left.do()
        if isinstance(result, IOZeroType):
            return result
        return self.right.do()
Exemple #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()
Exemple #3
0
class Or(IO, InfixMix()):
    op = "|"
    def do(self):
        result = self.left.do()
        if isinstance(result, IOZeroType):
            return self.right.do()
        return result    
Exemple #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)
Exemple #5
0
class ProcessorComposite(Processor, InfixMix()):
    op = ">>"
    __init__ = InfixMix().__init__

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