[Haskell-cafe] A round of golf
bos at serpentine.com
Thu Sep 18 13:25:35 EDT 2008
On Thu, Sep 18, 2008 at 10:02 AM, Creighton Hogg <wchogg at 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
main = mapM_ ((print =<<) . fmap (B.count '\n') . B.readFile) =<< getArgs
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe