Hacker News new | ask | show | jobs
by thedataangel 2313 days ago
Haskell's syntax without Haskell's type system sounds like a nightmare. The type system is what makes me at least vaguely confident that the incomprehensible string of symbols that make up a good chunk of Haskell expressions are at least close to being correct.

(And to be clear: I use Haskell professionally and love it - but the syntax is _not_ why most people use Haskell).

3 comments

Did the tagline "Slow. Stupid. Absolutely adorable." not clue you in that this is a joke?
The name alone should be enough.
Why?, not a native English speaker, I looked up doge and it has no meaning, any tips for other meaning?
I can’t identify with this description (“incomprehensible string of symbols”) at all, unless maybe you’re talking about Lens-based code or something.

I think most people who complain about the readability of a language like Haskell are confusing familiarity with clarity. We learned Java or C++ or whatever in school, and despite the fact that those objectively have more complex syntaxes and more meaningless symbols, they are “easier to read” because that’s what you started with. Haskell has a higher semantic density with fewer boilerplate symbols - surely easier to read from a first principles standpoint. If you started from a math background and are comfortable thinking in terms of equations, it’s almost certainly easier to read.

You can write Haskell defensively on the syntax level.

But it's much more common, at least for me, to eg just guess at operator precedences and leave out parens, because for the most part the type system will yell at you, if you get it wrong.

This is in stark contrast to the likes of C or C++, where the rule of thumb is 'when in doubt, add parens', because even when you get the precedence right when writing the code after looking it up, you'll most likely will have forgotten by the time you or someone else reads the code again; so you save everyone time with the extra parens.

The main thing I'd want from a better Python syntax would be to make more constructs in the language expressions with values instead of statements. For example, if-then-else. And introduce pattern matching.

The surface syntax might want to take more inspiration from Lisp instead of Haskell. Lisps are traditionally dynamically typed, so you can look at quite a few already thought through solutions.

I dabbled a bit in dogelang and the "great" thing is that it almost is Haskell but not. You can deconstruct tuples which looks like pattern matching but it isn't. You can use generator lazyness which looks like lazy and non-strict evaluation but the generator has an internal state.

It's amazing if you really try to write something haskell-like where it actually breaks.