pmjoe

pmjoe

Where Elixir fits in the functional programming world?

I don’t want this thread to become a flamewar, but I was having some huge discussions with a few friends regards functional programming. First of all, my background is in imperative languages, I understand the benefits and value proposition of FP, but I don’t have a math background, nor the academic interest to learn all the bases and proofs of FP.

Do you see Elixir a “less qualified” FP language than something like Haskell? Looks like lately FP means having an effect system and being statically typed, which kinda of rules out most of the languages apart from Haskell and a handful others. Even languages like Scala and Ocaml have lots of escape valves and they can fall into a imperative approach and do effects anywhere without the compiler knowing it, so it’s best effort at the end of the day.

Most Liked

gregvaughn

gregvaughn

I know the kinds of conversations and opinions you’re talking about. It’s important to realize that Haskell has come out of the academic community, and they’re exploring/implementing advanced computer science features. Elixir comes from Erlang, which was created to solve a business problem and focused on pragmatism (resilient systems even in the face of hardware failure) over purity. They have different goals and different language design tradeoffs, but they both treat functions as first class. I wish the academics had some other phrase besides “pure”/“purity” to distinguish their language goals, but then again I suspect that terminology helps them feel superior, so they have little motivation to change it.

jam

jam

IMO, elixir sits in the sweet spot. It’s what I see as FP-lite or pragmatic FP. I have a bias though to keep things simple and easy to reason about. “True” FP with monads and the like always struck me as prioritizing purity to the point where the code becomes difficult to grok. Perhaps there is a nirvana moment after spending substantial time with it.

100%

murrgelb

murrgelb

This is a very interesting discussion. We’ve seen effect-systems and immutability as characteristics (and even type systems - huh?).

I do 100% agree, that immutability is a differentiator for functional languages. However, what is also important is that functions are first-class. Passing functions as if they’re values and enabling higher order functions is the game-changer. This is what’s fundamental to implement different effect systems with ease. Monads? Sure just do it. Dependency injection? Free.

There are different ways to control side-effects. The trend in Haskell went from monad-transformers (which don’t compose) to free monads, to imitating an algebraic effect system. Man, the complexity. Scala did the same with catz and scalaz.

Elixir tends to be more pragmatic. What do we want to achieve? Is it for testing? Maybe use mocking or dependency injection? Is it for abstraction? Yeah, you can achieve 99% and implement composable abstraction without knowing category theory. We can do that, since we functions as first-class.

That said, I’d go with what @jam and @dimitarvp said: Elixir is a pragmatic functional programming language (as is e.g. clojure - no one will ever challenge clojure for not being functional).

Where Next?

Popular in Discussions Top

sashaafm
Piggy backing a bit on @dvcrn topic BEAM optimization for functions with static return type?, I’ve been trying to understand in a deeper ...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 13924 124
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19204 150
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement