|
|
|
|
|
by mjambon
4411 days ago
|
|
We use it in our backend to tie everything together. It serves an http/json api to our client apps (Web/JavaScript, Android/Java; iOS/Objective-C coming soon). We're handling the same data types in JavaScript, Java and OCaml. What is clear is that we spend a lot of time fixing type errors in JavaScript due to the lack of basic type checking. Java does not have this problem and for Android programming it is a breeze since really the mobile app is just a GUI which doesn't have to do anything clever with the data. Now the backend is in charge of serving correct data to the client apps. I could explain that OCaml is fast and lets us implement any CPU-intensive algorithm without having to switch to C, but the truth is most of our code is not much about algorithms but very much about data modeling and data management. Anything we store needs to be stored correctly if we don't want to accumulate broken data resulting in bugs that are costly to fix. Untyped languages such as JavaScript let you store anything without checking their conformance to a type definition, this is awful. Java for example would be perfectly acceptable if it wasn't so verbose. We want to write JSON-like records and arrays like in JSON or JavaScript. OCaml provides this, Java doesn't. Now, we don't want half of our code to consist in annotating each variable with a type. The compiler should infer that 123 is an int. How hard is that? You tell me. JavaScript doesn't check anything. Java or C++ force you to declare that 123 is an int. How clever is that? I don't know. OCaml, Haskell just figure out that 123 is an int. That's called type inference. That makes code readable like JavaScript or Python, with the safety of Java and the performance of C++. |
|
From my perspective it seems like there is more activity and research going on in Haskell.