Re:Solving `UK Passport Application` with Haskell
by cbsmith on Sunday June 29, 2025 @10:52AM
(#44413635)
I still don't understand equality in JavaScript. ;-)
Re:Solving `UK Passport Application` with Haskell
by IshKebab on Sunday June 29, 2025 @12:51PM
(#44414488)
The only thing to understand is that you need a blanket ban on `==` and `!=` using ESLint.
Re:Solving `UK Passport Application` with Haskell
by endgame on Monday June 30, 2025 @10:43PM
(#44430093)
Haskell operators are generally well-chosen to have a consistent visual language:
* $ is "function application" - f $ x = f x, but lets you elide nested parens: f $ g $ h x = f (g (h x))
* & is "reverse function application" x & f = f x. This reads nicely in pipelines as "and"
* <$> is "fmap" what is like a lifted application over a structure: f <$> [1, 2, 3] = [f 1, f 2, f 3]
* <&> is "reverse fmap", which is nice when you have a big lambda
* Anything in <_> brackets is generally a "lifted" version of some operator
* And so on
Yeah but the JavaScript operators are almost all universally understood. There are some exceptions and mistakes, like `===` which shouldn't exist, and `.?` which is new but fairly standard. But most of the operators are just standard maths stuff, normal array/field accesses, etc.
Haskell has normal operators plus a bunch of weird operators that you need to learn. Even if the raw number of operators is only 2x, the number of operators that you have to learn is probably 10x.
Especially when you consider that Javascript operators are fixed so you have to learn them once, whereas Haskell operators are user-defined and Haskell programmers love defining them.