Introduce OptionalPipe and ApplyPipe and use for optional match