6 ms·
Compare this to the error message you get from Rust with the same program though: error[E0277]: cannot add `[{integer}; 2]` to `{integer}` --> src/main.rs
by lpghatguy 5y ago
Compare this to the error message you get from Rust with the same program though:
error[E0277]: cannot add `[{integer}; 2]` to `{integer}`
--> src/main.rs:2:7
|
2 | 1 + [2, 3]
| ^ no implementation for `{integer} + [{integer}; 2]`
|
= help: the trait `Add<[{integer}; 2]>` is not implemented for `{integer}`
For more information about this error, try `rustc --explain E0277`.
Good error messages are important for adoption of languages with strong type systems. The complexity is already foreign enough for people who aren't familiar with type theory.
- erk__ 5y agoOcaml does also not have a bad error message: $ ocaml OCaml version 4.13.1 # 1 + [2; 3];; Error: This expression has type 'a list but an expression was expected of type int Though it is also more constrained than Haskell here
- antonvs 5y agoRust is more constrained in ways that make type inference easier and less ambiguous. One issue mentioned in the OP is the way numeric literals are typed in Haskell. Haskell also has a lot of optional language extensions, some of them quite researchy, and that complicates type inference and error messages. It also has curried functions. These can all be fantastic things to have, but they involve tradeoffs. Those tradeoffs mostly make sense in the context of Haskell's original research focus. "Adoption" of the kind you're presumably referring to was an explicit non-goal for a long time, and still is among some users. Edit: sometime else pointed out that more recent Haskell compilers give the error "No instance for (Num [Integer]) arising from a use of `it'" for this example, so this whole post may be kinda BS.