class DiscardL(IO, InfixMix()): op = ">>" def do(self): result = self.left.do() if isinstance(result, IOZeroType): return result return self.right.do()
class Bind(IO, InfixMix()): op = "&" def do(self): result = self.left.do() if isinstance(result, IOZeroType): return result return self.right(result).do()
class Or(IO, InfixMix()): op = "|" def do(self): result = self.left.do() if isinstance(result, IOZeroType): return self.right.do() return result
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)
class ProcessorComposite(Processor, InfixMix()): op = ">>" __init__ = InfixMix().__init__ def __call__(self, stream): return self.right(self.left(stream))