Live data from Hacker News

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

news.ycombinator.com

61–70 of 80 posts

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

#61
post #24

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

There’s a huge difference between being a functional language and supporting functional paradigms. Nearly every major language does the latter, but if you consider immutability a key functional feature, for example, you’ll sorely miss it when the language doesn’t really support it.

> but if you consider immutability a key functional feature ...

Fair point. I have to say that I appreciate both the libraries [1] and resources [2][3] concerning functional programming in the javascript community. The functional reactive programming movement is a neat example where we can find functional ideas brewing [4].

Say someone decides that vanilla JS isn't enough. They can play with functional first languages that transpile to JavaScript [5][6].

[1] http://ramdajs.com/

[2] https://www.gitbook.com/book/drboolean/mostly-adequate-guide...

[3] https://leanpub.com/javascript-allonge/

[4] https://cycle.js.org/

[5] http://elm-lang.org/

[6] http://www.purescript.org/

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

#62
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.

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

#63
post #59

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…

Interpreted language? Common Lisp is typically compiled. Besides which, why is interpreted a particular advantage? e.g. Python was interpreted 10 years ago when I was using it, but Common Lisp felt far more flexible and powerful, because you can compile single functions with a key press in SLIME and seamlessly load them into your running (compiled) image... shortest feedback loop I've ever experienced. Maybe Python h…

I instinctively used the "interpreted" term, because mainly you can execute instructions on the fly in an interpreter the language ships with. Whether it's compiled to bytecode and then executed from there is IMHO an implementation detail. With compiled languages (following this logic) such as Java or Go or C, you need to write your program pass it through a compiler to get an output.

With languages like Javascript, Lisp, Python, Ruby etc. you can write your programs incrementally, going back and forth between the REPL.

Sorry if my terminology has caused you trouble. I regard dynamically typed languages that ship with an interpreter as interpreted languages. For optimization reasons the implementation probably uses some sort of compilation but you can still use the built-in interpreter on all of these "interpreted" languages.

I should probably have used the term "ships with an interpreter" :)

BTW the current python-mode in Emacs also allows SLIME-like behaviour. You can open a python process with C-c C-p and then send the buffer, functions, marked areas, lines etc. to the python session.

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

#64

Earlier quoted context omitted.

I'd like to add that with F# you get all the benefits of an extremely mature web stack with asp.net core and a huge eco system of very high quality libraries. Frameworks like Giraffe, Suave or Freya make it all possible to write your backend in a functional idiomatic way. Also a big plus for F# is the choice of top notch tooling. You've got Visual studio which works on Windows and Mac, then JetBrains Rider which is a…

I am also leaning towards F#. What do you use for json serialisation? Any guide which describes basic steps to put together a web api.

This e-book http://products.tamizhvendan.in/fsharp-applied/ should get you covered, Version II is just out :-)

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

#65

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 developer…

I second that Elixir's ecosystem is exceptionally great for such a young language. I love working with it. That said, I'd wager it can hardly be called a functional language. Sure, you can't write for loops, but every Elixir process encapsulates a little piece of mutable state. Elixir and its ecosystem allow and encourage you to have (very) many processes, and thus many global singleton-like pockets of mutable state.…

While I don't disagree entirely, I find that Elixir is actually quite functional. Using processes for state as if they're objects is generally considered bad practice.

I can highly recommend this article (also just in general for people curious about Elixir): http://theerlangelist.com/article/spawn_or_not

A quote:

> But before starting, since this is going to be a long article, I want to immediately share my main points:

> Use functions and modules to separate thought concerns.

> Use processes to separate runtime concerns.

> Do not use processes (not even agents) to separate thought concerns.

> The construct “thought concern” here refers to ideas which exist in our mind, such as order, order item, and product for example. If those concepts are more complex, it’s worth implementing them in separate modules and functions to separate different concerns and keep each part of our code focused and concise.

> Using processes (e.g. agents) for this is a mistake I see people make frequently. Such approach essentially sidesteps the functional part of Elixir, and instead attempts to simulate objects with processes.

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

#66
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.

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

#67
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

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

#68
post #21

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

I second F#. You have access to the full .NET Standard library as well as all of the open source libraries available. I personally found it more of a joy to use than Scala, but that may be due to my knowledge of and experience with .NET. F# on .NET Core is stable and there are templates for an F# web application.

I'm an experienced Scala dev but after reading the "fun and profit" ebook F# looked really interesting. Naturally I tried to take the next step of creating a small webapp with it on a Linux dev machine. Unfortunately I ran into a lot of problems identifying and setting up the needed tools and frameworks on Linux and eventually gave up. My assumption was that the tooling+frameworks were likely "not quite there yet" (late 2017) for Linux but I'd love to be proven wrong. Any suggestions for an up-to-date tutorial on "web development using F# on Linux"?

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

#69

Earlier quoted context omitted.

I second F#. You have access to the full .NET Standard library as well as all of the open source libraries available. I personally found it more of a joy to use than Scala, but that may be due to my knowledge of and experience with .NET. F# on .NET Core is stable and there are templates for an F# web application.

I'm an experienced Scala dev but after reading the "fun and profit" ebook F# looked really interesting. Naturally I tried to take the next step of creating a small webapp with it on a Linux dev machine. Unfortunately I ran into a lot of problems identifying and setting up the needed tools and frameworks on Linux and eventually gave up. My assumption was that the tooling+frameworks were likely "not quite there yet" (l…

I had same experience before. But I request you to give it a try now. The experience is much better now!

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

#70

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.

You mentioned Erlang, where do you normally use it?

Well, the erlang vm is what runs Elixir apps. Elixir runs on the erlang VM (called BEAM) similar to how scala/clojure run on the JVM. However, while writing a lot of elixir code you end up using the erlang standard library for things which are not available in Elixir, :crypto is a module which comes to mind. Elixir apps at the end of the day are erlang apps.
Post reply on HN