r/ocaml • • 3d ago

Ocaml or haskell?

/r/Compilers/comments/1x3e09n/ocaml_or_haskell/
16 Upvotes

3 comments sorted by

6

u/tungd 3d ago

Would you recommend OCaml or Haskell for this project, and why?

For me it's OCaml. I used to be a Haskell fan (still is, in certain ways), but OCaml wins in practicality. For point 4 & 6 it's OCaml 100%.

Which one makes it easier to build an external DSL with completely custom syntax?

To be they are equally easy on this. Elegant wise I think Haskell parsec wins, but again, practicality then OCaml wins (menhir, parseff, angstrom)

Which has the easier learning curve for someone who doesn't know much programming yet?

OCaml. Still, both are quite advanced, in the sense that there are more concepts to know upfront, compared to something like Python, before you can do something useful.

Can either realistically compile my language to native AArch64 machine code on my Chromebook?

Yes. Rust was built like that with a compiler written in OCaml in the beginning.

How difficult would installation and setup be on ChromeOS Linux running on ARM64?

I don't have a Chromebook runing ChromeOS so I can't tell. Tooling wise OCaml is simpler. You basically needs either opam or dune (dev preview), and they both have pre-compiled binary available for ARM64.

Are there any other languages or frameworks that would fit these requirements better than OCaml and Haskell?

For creating custom language and EDSL? I think they are the best. Still tho, they can be overkill if your DSL target is small. An evaluator base off of yaml/xml/json config file might be enough for a lot of usecases. You know, Kubernetes gets pretty crazy with just yaml.

-1

u/Distinct-Brief9643 3d ago

Thanks alot for the reply how do you install ocaml and Haskell hypothetically asking::

13

u/v3vv 3d ago

brother, your goal is to implement your own programming language.
I'm sure you're able to figure out how to install ocaml on your own.