Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The formatting is no weirder than Python's.

You could ask many of the same questions of Python's non-C/non-Java like syntax:

- What is "def"?

- Why the weird formatting? (And unlike Haskell, Python's tends to be stricter!)

- Why do I need to write ":" after some lines but not others? It doesn't work like the semicolon in C-like languages!

- What's with the "if __name__ == '__main__'" weirdness I see in some Python programs?

- What's this weird [f(x) for x in ...] syntax? It doesn't look like anything in C. What's with the brackets anyway?

Etc.

Yet Python with its "weird" syntax and constructs is a hugely popular language...




Python is more popular than Haskell, which is why it's easier to google.

Do note Haskell tutorials and communities abound, and you have excellent online tools such as Hoogle (in which you write the type of what you think you want and it responds with "these are functions with a similar type signature, with their documentation"). It's easy to google Haskell things, just not as easy as googling Python things :)

Do note the type definitions from the example are Haskell 101 and will be covered very early in almost every tutorial, for example Learn you a Haskell.

PS: it's not a "pipe operator" you're looking for. This isn't an operator at all! The "|" you're looking for it's in a definition, and it means a union of alternatives (this type can be "this" or "that" or "this other thing"). If you think about it, this "union-or" is written the same as the bitwise-or from more popular languages :)




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

Search: