A general way to consume input using applicative functors