On Thu, Sep 18, 2008 at 10:02 AM, Creighton Hogg <wchogg@gmail.com> wrote:

If this makes anyone cringe or cry "you're doing it wrong", I'd
actually like to hear it.

Yes, that made me cry :-)  Your code seems very convoluted, and quite successfully hides what it's really trying to do. Here's a version that is rather more concise, and which will be far faster besides.

import qualified Data.ByteString.Lazy.Char8 as B
import System.Environment

main = mapM_ ((print =<<) . fmap (B.count '\n') . B.readFile) =<< getArgs