Hacker News new | comments | show | ask | jobs | submit login

I haven't seen this Haskell syntax before:

  [1,3..10] ⇔ [1,3,5,7,9]
Imagine running into this one on a production system... Someone needs to make a 'Haskell: the good parts' or at least a lint.

How is that weird, it's just uses the increment from the first to second value as step and repeat as long as it's smaller than the end value. Python does the exact same thing:

    Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> range(1, 10, 2)
    [1, 3, 5, 7, 9]

> Someone needs to make a 'Haskell: the good parts' or at least a lint.

Someone needs to write a book about the good parts because you haven't learned the language? It's documented right in the Prelude[1] what this desugars into.


You'll see that in a lot of languages that include list comprehensions as part of their syntax.

There is a linter, called hlint, which is extremely useful. It doesn't flag that, though, nor do I see any reason it should.

Are you implying it's complex? Because a lot of languages have list comprehensions[1] (list comprehensions are awesome!). Haskells is very close to the mathmatical set-builder notation[2].

An example of a more advanced one would be

    >> [2*x | x <- [0,1..25], x^2 `rem` 3 == 0]

Also, there is HLint for Haskell linting purposes...

[1] http://en.wikipedia.org/wiki/List_comprehension#Examples_in_...

[2] http://en.wikipedia.org/wiki/Set-builder_notation#Parallels_...

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact