Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What the deuce is FIOC?

Name: !Girugamesh7eNf 2009-07-16 1:01

Ive searched Google and Wikipedia and the only links I get send me right back here. So, /prog/, what is FIOC and why does the rest of the internet not know of its existence?

Name: Anonymous 2009-07-17 10:52

THE HASKELL INDENTATION OF CODE
The reader may have been wondering how it is that Haskell programs avoid the use of semicolons, or some other kind of terminator, to mark the end of equations, declarations, etc. For example, consider this let expression from the last section:

let y   = a*b
    f x = (x+y)/y
in f c + f d


How does the parser know not to parse this as:

let y   = a*b f
    x   = (x+y)/y
in f c + f d


?

The answer is that Haskell uses a two-dimensional syntax called layout that essentially relies on declarations being "lined up in columns." In the above example, note that y and f begin in the same column. The rules for layout are spelled out in detail in the Report (§2.7, §B.3), but in practice, use of layout is rather intuitive.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List