[Haskell-beginners] clarity and complexity of Haskell code?

Gregory Guthrie guthrie at mum.edu
Sun Sep 25 17:25:25 CEST 2011

I always enjoy and tout the clarity and simplicity of the declarative style of functional programming, and with that also Haskell.

But it seems that although the wonderfully short and clear examples dominate early learning and usage, the forums like this and café are dominated by examples more like this:

     import Data.Enumerator (run_, ($$), (=$))

     import Data.Enumerator.Binary (enumHandle, iterHandle)

     import Data.Enumerator.List as EL (map)

     import Data.ByteString as B (map)

     import Data.Bits (complement)

     import System.IO (withFile, IOMode(..))

     main = withFile "infile" ReadMode $ \inh -> withFile "outfile"

     WriteMode $ \outh -> do

         run_ (enumHandle 4096 inh $$ EL.map (B.map complement) =$ iterHandle outh)

And many more - looks more like APL or Perl to me. :) Certainly not the Python'ish model of "anyone can read this, and it is clear what it does".

Seems like the assertion that FP is easier and more clear is true at introductory levels, but there are some subsequent big gradients in the learning and usage curve. I use it only in very simple and small programs, so wondered about the observations on this from more experienced experts.

I wonder if any studies have been done to quantify and measure the complexity of programs in Haskell, as a way to assess this property.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110925/75b3e695/attachment.htm>

More information about the Beginners mailing list