|
|
|
|
|
by hardwaregeek
2015 days ago
|
|
Infix operators are certainly more readable if you're familiar with the operators. I imagine the possible ways of handling non-nullable types (and algebraic types as a whole) as a spectrum: * TS style explicit if branches: Easy for beginners, annoying to experts * Rust style methods on Option/Result/etc: Slightly confusing for beginners, somewhat elegant for experts * Haskell/OCaml style infix operators: Confusing for beginners, elegant and easy for experts Note that this is beginners to functional programming. Not necessarily beginners in programming as a whole. Plenty of smart people would get tripped up by a `<$>` |
|
Something as common as option types (which is basically how nullable types are used in Kotlin) deserves special syntactic sugar, in my opinion. Granted many of Haskell's operators are also common, but I wish they'd been able to limit the variety a bit.