5 ms·
Looks like that is exactly the error message predicted. It’s expecting a list of result values, but is getting a list of functions from some stuff to that resu
by abathologist 4y ago
Looks like that is exactly the error message predicted. It’s expecting a list of result values, but is getting a list of functions from some stuff to that result.
IME, it’s definitely true that OCaml doesn’t have the didactic error messages that many have come to like in Rust et al. They said, imo they generally give the information needed solve problems and I like their concision. It takes a bit of time to learn to read them however.
- muglug 4y ago> It takes a bit of time to learn to read [OCaml's error messages] Yeah, and I think you could say the same of Rust when it comes to the borrow checker's messages. But in Rust's case the problem it's trying to describe is itself pretty complex. The complexity of OCaml's error messages are really not justified by the problem they're warning you about, which is itself very straight-forward.
- ahmedalsudani 4y agoThe ML languages started appearing in the 70s. Rust is a very modern language. Where do you think rust got (more than) half of its type inspiration from? Either way no one has to use any language. Personally OCaml is not my cup of tea--Haskell is. But it is a great tool and it's solving hard problems.
- muglug 4y agoI used StandardML at university in the early 2000s, and I appreciate that OCaml is an older language that heavily influenced the design of Rust. Given that history, it’s instructive to note the sorts of things (like auto-currying) that Rust did not inherit.
- ahmedalsudani 4y agoRust is a different language with a different audience. If a functional language is presented today that does not automatically curry calls, I have no interest. Just because the tool does not work for you does not mean there's a defect in the design.
- octachron 4y agoI think that it is better to not forget that expressiveness comes at the cost of a richer world of misbehaving code. If you are used to a world where functions have more than one argument and must be applied to exactly the right number of arguments and nearly never returns another function, starting a curried language suddenly throws you in a situation where many small mistakes like `plus 1` are not caught early anymore. Moreover, those delayed mistake are here to allow room for an expressiveness that you are not using yet. This is a genuinely frustrating situation. And I do hope to improve OCaml type error messages to better highlight type difference at some point in the future.
- muglug 4y agoThanks for the work you’re doing — though it’s mostly too late for me, good to know that people are putting a lot of thought into these questions. The sense I have got from my experience is that OCaml is a great language for people who are slightly less error-prone than I am. My style of coding is to write a lot of slightly dodgy code in one breath, then use the typechecker to tell me all the things I got wrong. Even in a language I’m very familiar in there’s still a lot of trial and error. OCaml currently seems great for people who are better at getting it mostly-right first time — I’ve seen a lot of OCaml code written by people with PhDs and backgrounds in type theory. Most other languages don’t have that sort of academic pedigree.
- yawaramin 4y ago> My style of coding is to write a lot of slightly dodgy code in one breath, then use the typechecker to tell me all the things I got wrong. That's exactly the style OCaml excels at. > OCaml currently seems great for people who are better at getting it mostly-right first time That's because they got it wrong a lot at first, then learned how to get it right. You've heard of people talking about how they internalized the Rust borrow checker's rules after some time, right? Well, internalizing a typechecker's inference rules works very similarly (faster if you read OP). > I’ve seen a lot of OCaml code written by people with PhDs and backgrounds in type theory. That's unfortunate, it's a nearly perfect language for industrial work. Tiny example of how easy it is to hack together useful tools with it: https://dev.to/yawaramin/practical-ocaml-314j#proof-of-concept https://dev.to/yawaramin/practical-ocaml-314j#proof-of-conce...
- Akronymus 4y agoTo me, the previously linked error message seems pretty clear.