Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

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.)
Subscribe

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • google ime

    Japanophiles might be interested to learn that Google released a Japanese IME. IME is the sort of NLP problem that Google is nearly uniquely…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments