Comment by mhitza

Comment by mhitza 3 days ago

3 replies

That's a hard agree and a reason why anyone trying to learn Haskell, OCaml, or other language with minimal/"batteries depleted" stdlib will suffer.

Sure Haskell comes packaged with parser combinators, but a new user having to juggle immutability, IO and monads all at once at the same time will be almost certainly impossible.

PapstJL4U 3 days ago

Maybe not learning a new language from the ground up, but I think it is good training to "just write" within the language. A daily or twice-daily interaction. Setting up projects, doing the basic stuff to get things running, and reading up on the standard library.

Having smaller problems makes it possible to find multiple solutions as well.

talideon 2 days ago

I typically use OCaml myself for them and have never found the standard library to be particularly "depleted" for AoC, though I do have a couple hundred lines of shared library code built up over the years for parsing things, instrumenting things, and implementing a few algorithms and data structures that keep cropping up.

Also, dune makes pulling in build dependencies easy these days, and there's no shame in pulling in other support libraries. It's years since I've written anything in Haskell, but I'd guess the same goes for cabal, though OCaml is still more approachable than Haskell for most people, I'd say. A newbie is always going to be at some kind of disadvantage regardless.

  • mhitza 2 days ago

    > I do have a couple hundred lines of shared library code built up over the years for parsing things

    I think that's the best example of anemic built-in utilities. Tried AoC two years ago with OCaml; string splitting, character matching and string slicing were very cumbersome coming from Haskell. Whereas the convenient mutation and for-loops in OCaml provide an overall better experience.

    Given you're already well-versed in the ecosystem you'll probably have no issues working with dune, but for someone picking up OCaml/Haskell and having to also delve in the package management part of the system is not a productive or pleasant experience.

    Bonus points for those trying out Haskell, successfully, than in later challenges having to completely rewrite their solution due to spaceleaks, whereas Go, Rust (and probably OCaml) solutions just bruteforce the work.

    I'm probably just that bad at programming.