[Haskell-beginners] question on layout

Magnus Therning magnus at therning.org
Wed Jun 17 04:19:38 EDT 2009


On Wed, Jun 17, 2009 at 12:41 AM, George Huber<geohuber at verizon.net> wrote:
> (1) what was the driving force behind using white-space to denote code
> blocks?  From a beginners perspective (especially coming from a strong C /
> C++ background) this seems to add to the learning curve for the language,
> and can add a good deal of frustration.

I only really know two languages that use significant whitespace in
this way, Python and Haskell.  I learnt Python first, and had
basically the same thoughts as you do.  It felt weird, even though I
always made sure to indent my C/C++ code to make it more readable.  It
took some time, but by now I love it, and consider it a positive point
of both languages.  IMO the people behind Haskell had a better
understanding of the off-side rule though, so there are less
strangeness in Haskell indentation.  By now I find that my indentation
practices are leaking into other languages, e.g. from a distance my
OCaml code looks similar to my Haskell code.

You may be right that it adds to the learning curve, but I consider it
well worth it in the long run.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Beginners mailing list