• @pkill@programming.dev
    link
    fedilink
    8
    edit-2
    2 months ago

    purely functional paradigm (immutable data structures and no shared state, which is great for e.g. concurrency) and advanced type system (for example you could have linear types that can be only used once). Lisps build on the premise that everything is data, leaving little room for bloated data structures or tight coupling with call chains that are hard to maintain or test. In Haskell on the other hand, everything is a computation, hence why writing it feels more like writing mathematical equations than computer programs somehow. It might, along Scala be good for data-driven applications.
    Also the purely functional syntax means that on average, functional programming languages will arrive at the same solution in approx. 4 times less LOC than procedural/OO according to some research. Just look at solutions to competetive programming problems.
    And even though I’m not a big fan of opinionated frameworks, compare some Phoenix codebase to a Symfony or even a Rails one to see how much cleaner the code is.

    But if you’re new to FP you should rather pick Scheme, Elixir or Clojure since the paradigm itself can be a little bit hard enough to wrap your head around at first (though Elixir and is a bit imperative, depends on how deep are you ready to dive in), not to mention having to learn about ADTs and category theory.

    • @krewjew@lemmy.world
      link
      fedilink
      22 months ago

      My favorite feature is how currying is applied literally everywhere. You can take any function that accepts 2 args, pass in a single arg and return a new function that accepts one arg and produces the result. In Haskell, this is handled automatically. Once you wrap your head around using partially applied and fully saturated functions you can really start to see the power behind languages like Haskell