Support printing lines, 'p'

Ugly code, I know. Would using the writer monad make this clearer?