[Haskell-cafe] Software Tools in Haskell

Henning Thielemann lemming at henning-thielemann.de
Fri Dec 14 03:29:06 EST 2007


On Wed, 12 Dec 2007, Don Stewart wrote:

> ndmitchell:
> >
> > A much simpler version:
> >
> > main = print . length . words =<< getContents
> >
> > Beautiful, specification orientated, composed of abstract components.
>
> My thoughts too when reading the initial post was that it was all very
> low level imperative programming. Not of the Haskell flavour.

I remember there was a discussion about how to implement full 'wc' in an
elegant but maximally lazy form, that is counting bytes, words and lines
in one go. Did someone have a nice idea of how to compose the three
counters from implementations of each counter? I'm afraid one cannot
simply use the "split and count fragments" trick then.


More information about the Haskell-Cafe mailing list