evan_tech

Previous Entry Share Next Entry
03:26 pm, 19 Feb 04

whitespace

Section 2.7 of the Haskell report (bottom of here) talks about their "layout". (See the very bottom for an example.)

This is neat. The language is defined with braces and semicolons. But:
Haskell permits the omission of the braces and semicolons used in several grammar productions, by using layout to convey the same information. This allows both layout-sensitive and layout-insensitive styles of coding, which can be freely mixed within one program. Because layout is not required, Haskell programs can be straightforwardly produced by other programs.


I remember the first time I tried to embed Python into a web page and I realized I had to figure out how to make the whitespace work out so my if statements would work. Haskell's system allows really simple and good-looking code for the common case (I don't think I've ever seen a curly brace in any Haskell code) but still can be defined as whitespace-insensitive.

By the way, Haskell code is totally hot. Even though I still can't figure out how to use it.
(Cut 'cause I'm afraid I'm posting too much.)