I've been using Haskell in production for 8 years.
I've been using OCaml in production for 8 months.
It's time to compare those two languages.
...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks! I hope you enjoyed your time at Bloomberg 🤗
Indeed, this particular example could be written better with the usage of pattern matching. I wanted to show the difference between guards and if-then-else. But looks like this particular example is not that convincing.
I'll change it to a better one when I come up with it!
Meanwhile, you might have some other example in mind?
If we are comparing succinctness, let me offer an alternative parsing example :-)
Good example! I often forget OCaml has
sscanf
too as well asprintf
😅I was so infuriated by that library that I made one to fix all its problems. ;)
github.com/dmbaturin/otoml/
It's actually compliant with the TOML standard, uses transparent types (but also offers helpers for getting nested values), and uses functors to allow the user to plug any datetime and bignum libraries or stick with built-in native int and string dates.
Well, and offers informative parse errors, too.
Hey @dmbaturin
I was informed that
ez_toml
is better thanotoml
:discuss.ocaml.org/t/8-months-of-oc...
Do you have a comparison with this library somewhere?
Thanks for letting me know! Your library looks great, I'll update the link 🔗
I follow you on twitter and saw your recent posts about ocaml, so I decided to actually try it out. Using it for a bit during the holidays made me feel like it's just worse Haskell. When I saw your post, I thought that I'd see some features that are amazing, while it might just be my viewpoint, the stuff you're showing me here makes me want to use Haskell even more.
Less than language features a few of the libraries are really cool tho. I'd love to have something akin to owl (cl.cam.ac.uk/~lw525/owl/chapter/pl...)
It's totally fine to have different preferences!
If you enjoy using Haskell, you can continue using it 🤗
You forgot the best asset OCaml which is its Web framework. Ocsigen is the most advanced web development framework. It's revolutionary once you get how it works. Nothing else can compete, in any language.
I never tried Ocsigen. I guess, it's hard to compare two languages fully because you can never try everything.
But you reply gave me some motivation to try it 👀
I’ve been using OCaml for 4 years now, but never used Ocsigen for web development. I have some experience with ReScript with React tho. I’m really curious about using OCaml for both front/backend; why would you recommend Ocsigen (vs something like Dream)
Awesome post!
I tried OCaml many years ago. I think around the same time I started playing with Haskell, but gave up on OCaml due the fact that Haskell felt more pleasant to use. You definitely made me wanna try OCaml again :)
I'm glad my post was inspiring enough 😊
I received tons of feedback on my OCaml vs Haskell blog post! Thanks a lot to all who read and shared their thoughts 🤗
Using the feedback, I improved my post by:
✍️ Changing the most triggering exponentiation example to a different one
✍️ Added links to all discussions of my blog post all around the Internet
✍️ Changed feature from 'Laziness by default' to 'Composable laziness'
✍️ Added 'topiary' as an OCaml formatter
✍️ Changed the suggested TOML library from 'To.ml' to 'otoml'
✍️ Changed the suggested AWS library from 'ocaml-aws' to 'awsm'
Hope you enjoy it!
Terrific post!
For the comparison table, possibly include records support. This has been a Haskell deficit for decades, and no thank you, lenses are a bloated, heavyweight bolt-on when you just want simple, lightweight record support.
Thank you!
Haskell kinda has a better record story nowadays. You can actually have nice records in Haskell without using lenses!
Nice article. It's great to have the two languages side by side as I'm tempted to have a closer look at OCaml.
Thanks!
Yes, I really wanted to compare these two languages.
You can find other blog posts comparing Haskell and OCaml (some are older, some are newer). But I wanted to provide my take anyway and share my experience 😌
Great article! Really nice to see you're enjoying OCaml, I've been looking at it too, but have not actually used it yet, but this makes me even more interested in trying it out.
Thanks a lot, Pablo!
If you liked Haskell, I think you'll enjoy OCaml too 🙂
Lovely article! I look forward to trying out ocaml as well.
It's tradeoffs seem a lot like Go. Fast compile times, minimal syntax and moving parts,
Thanks! I think you'll enjoy OCaml 🤗
I do see it like Go of FP languages. Which is kinda the best of both worlds 😉
Nice article, now I have a bigger picture of Functional Languages!
I'm glad I was able to help with my article! 🙌
Great post! I'd like to see another comparison including F# as well.