1 comment

sorted by: hot top controversial new old
[–] 2 points 5 days ago* (last edited 5 days ago)

I really like how the Rust developers looked at prior art, and combined some of the best ideas from various sources into something new. Traits are basically Haskell type classes. They're modified a bit to allow fluent method chaining; but you can still call trait methods via the trait reference which is the Haskell style. Associated types in traits match up with one half of the functionality from GHC's Type Family language extension.

Enums, the Option and Result types, and pattern matching come directly from the ML language family. Hygienic macros also have roots in functional programming.

Iterators bear a passing resemblance to Haskell's lazily-evaluated lists. In both cases you can pile on transformations without intermediate allocations. But of course the implementations are very different.

  • source