Ask HN: Which functional language has the best ecosystem for a web backend?

  • I have been using Elixir for the past more than 2 years and got say that it has an awesome ecosystem for overall web development, I've been using and writing open source libraries and they are looking pretty solid as well. The company I work for also uses it as its main backend for the past almost 3 years and it has been working nicely since then. Hiring also got way easier, not only because of the existing developers using it already but also because the interest on it has increased.

  • Clojure! the thing I like most about a lot of the libraries is how they seem to blend so seamlessly. I don't know if it's an artefact of just being a lisp or just a lot of the developers sharing a mindset, but the whole experience feels less janky.

  • Well, IMHO It's F#. F# is really good due to it's better tooling and you have access to the plethora of libraries and framework of the .NET Ecosystem. Unlike Scala or Kotlin, F# retains a lot from it's functional roots like - Automatic Currying - ML Type System

    Plus it adds some really innovative features like - Type Providers which allows you to lazily/automatically generate Types for real world data/systems which is pretty cool.

    Ultimately it boils down to the Runtime/Tools/Ecosystem which is also true for Scala and Kotlin but it retains a lot from it's OCAML Heritage which makes it lean more towards FP than it contemporaries

    PS - I didn't mention clojure as I don't consider dynamic languages a good fit for building large codebase backend systems

  • We at Crowded (https://crowded.co) have had some very good successes with running F# on .NET Core, both with giraffe and just bare ASP.NET Core. The ecosystem has no shortage of good tooling and libraries, all well maintained by knowledgeable authors. Application performance and our development productivity is excellent, osx/linux tooling took a while to mature but is only getting better than ever now.

    The choice we made when .NET Core was still in development (pre 1.0) for it to become our main stack is definitely paying off!

  • Elixir/Erlang are one among best functional programming languages for web today. Phoenix is a very performant and productive web framework. You can build a typical web app really fast using Phoenix and Elixir.

  • I find .NET Core (particularly ASP.NET Core with F# via Giraffe - https://github.com/giraffe-fsharp/Giraffe) extremely good since Microsoft went all open source. I have multiple backends running in a GCloud Kubernetes cluster and develop all my stuff from a non Windows environment. Couldn't be more happy and the speed of ASP.NET Core with Giraffe is fantastic (~100K r/s).

  • Haskell's Yesod framework has a pretty solid ecosystem. It even comes with a free book:

    https://www.yesodweb.com/book

  • F#, first because its ecosystem is the whole .NET Framework world of libraries, utils, etc. Second, because it's got its own set of very functional libraries like suave.io for web apps/services, FSharp.Data for consuming data of diverse sources/natures, Fable.io an elegant JavaScript transpiler. Finally, with very demanding production projects like jet.com it already has proved that it can process massive amounts of transactions.

  • Today I would say Java/Scala mostly because of jvm access to huge numbers of libraries. But also because of things like Akka.

    There may be other options depending on whether you consider JavaScript or Go to be a functional language.

  • Some would say that Rust is a functional language.

    http://science.raphael.poss.name/rust-for-functional-program...

    Rust has an ecosystem for building web backends.

    http://www.arewewebyet.org/

    Does Rust have the best ecosystem for a web backend, though? I think that will depend on who you ask and what you are looking for specifically.

  • For backend you'd have Scala on the JVM side and F# on the .NET side.

  • This completely depends on what you want out of your web backend!

    Do you need some sort of rest-like HTTP API? Highly suggest Haskell and the Servant framework! It's amazing.

  • Been using F# in a web-backend capacity for about two years now. Language is great, hits a very sweet spot when it comes to productivity, tooling (F# has some of the best dev tools out there), etc. Interop with the rest of .NET is pretty much seamless, so there's no lack of good libraries.

  • I'd say that in terms of ecosystem, anything running on the JVM is probably going to be the broadest; that is, you'll have the most choices (mostly Java libs and frameworks) to decide from. In terms of functional libs/frameworks, that number will drop a lot, but in practice you'll probably have what you need.

    If the JVM or Scala/Clojure doesn't sound like a good time, F# is a good option (I'm biased as I work on it). The ecosystem is similar in that most libs/frameworks on NuGet are for C# developers, but in practice you really won't need them for a web service. Giraffe, Suave, and Freya are three choices that will run on .NET Core today.

  • Eco-system-wise you might want to try compiling from a functional language to JS and target Node.js -- Bucklescript or GHCJS would be my choices. That way you get access to all of the libraries on NPM.

  • I've been using Clojure on the backend for about 5 years now and find it an absolute joy to work with, having come from a Java background. You get full access to the masses of Java libraries out there as it's on the JVM. Great community support, too.

    As an addition, there's also ClojureScript for the front-end. It's come a long way recently, and I've been using it for the last couple of years in production (check out reagent and re-frame if you're interested).

  • I wouldn't call its ecosystem great, but if you like complex type hackery and don't need to do anything very complicated, Ur/Web can get you quite far.

    It's very hard to learn, especially if you're not that familiar with Haskell and SML/OCaml, but once you grok it writing CRUD apps is a breeze. Just be prepared to spend a lot of time looking at the standard library's signature files.

  • Do note, that some functional languages have good out-of-the-box support for both backend and frontend. An this is not negligible. I'm using F# which in combination with Fable (F#->.js transpiler) lets me really quickly share code, datastructures and serialization with frontend code.

    Now, I'm a primarily a backend developer. But sometimes it is just really convenient to be able to hack together an in-house real-time data-analysis or reporting service and render statistics as webpages rather than .csv documents.

    If your frontend team is functional as well, then the benefits of sharing the language could be even bigger.

    Sure, not everything is perfect in the F# world. However having the possibility to share code with frontend saves me more time than I spend in fighting with the F# ecosystem. And also: programming in F# is just fun joyful. And productive.

  • I'm surprised nobody mentioned good-old Common Lisp. With quicklisp you get access to a ton of libraries.

    For example you might be interested in: http://8arrow.org/caveman/

    Lisp ecosystem is really mature and gives you a lot of freedom.

    Dynamic typing, interpeted language, homoiconity, tons of great battle-tested libraries etc., Lisp is truly a great language for backend web development.

    Even this very site runs on a homebrew lisp dialect (Arc) running on Dr. Racket (Scheme). If even that bizarre setup (sorry PG :)) can handle this much traffic on a single server, you shouldn't worry about speed or scalibility if you opt for Common Lisp.

  • I got excited by both Elixir and Clojure, but vastly prefer Elixir. That said, Clojure would probably be my second choice and one major advantage is that ClojureScript would allow you to also build out the front-end in the same language. As far as I know Elixir's equivalent, ElixirScript, is nowhere near ready enough for that.

  • js actually supports functional paradigm. So, node.js has the most mature ecosystem for web i guess.

  • Define "ecosystem for webbackend". If all you want to do is put up a decent HTTP/REST-ish API all large languages have multiple good options.

  • Elixir is a good bet

  • Idris with Idris4Web is a very basic framework

  • Arc?

  • elixir or scala + akka

  • JavaScript.

    If you want purely functional, both haskell and clojure do have a good backend community and quite a few good tools.

  • OCaml with Ocsigen