Haskell's syntax, like many FP syntaxes, is inscrutable on first acquaintance. There's a reason hybrid languages like Elixir thrive...
Rust's memory management is a great boon for a close-to-the-metal language, but if all your types are immutable you don't actually need/want to deal with the borrow checker.
Typescripts toolchain and ecosystem are... ok, at best? I'd give a solid pitch for the Rust ecosystem having reproduced the best parts thereof (and there is still room for improvement even so)
The type system means you don't have to worry about folks hiding pointers in arbitrary pointer-sized integers, so you know all the roots ahead of time.
Immutability means you can only ever create references in one direction (i.e from new objects to old objects), and you can't ever create cycles.
This lets you do fun shit like a mark&sweep garbage collector in a single pass (rather than the usual two) - and if you have process isolation guarantees (a la Erlang), you don't necessarily have to suspend execution while it runs. Or maybe a generational collector where the generations are entirely implicit.
You can write extremely haskell-like code with Rust.
Here's the first example in rust:
fn safe_head<T>(list: &[T]) -> Option<&T> {
match list {
[first, ..] => Some(first),
[] => None,
}
}
fn print_the_first_thing(my_list: &[String]) {
match safe_head(my_list) {
Some(something) => println!("{}", something),
None => println!("You don't have any favourite things? How sad."),
}
}
fn main() {
let my_favourite_things = vec!["raindrops on roses".to_string(), "whiskers on kittens".to_string()];
let empty_list: Vec<String> = vec![];
print_the_first_thing(&my_favourite_things);
print_the_first_thing(&empty_list);
}
(of course Rust has a lot of helper functions that avoid all that verbosity -- you can do the whole thing in one expression, if you want) println!(
"{}",
my_favourite_things.get(0).map_or(
"You don't have any favourite things? How sad.".to_string(),
|something| something.to_string()
)
);I still love the language, BTW.
I actually really like the syntax as it makes it easy to write DSLs which are actually just Haskell functions.