# Haskell, Scala and Elixir

> Three languages built around functions that hand back new values and change nothing. What each one is for, and why that style suits busy servers.

**Course:** [Programming Languages](https://learn.benibix.com/learn/development-languages)  
**Time:** 12 min

**After this lesson you can:**

- Say what a functional language is
- Name what Haskell, Scala and Elixir are each used for
- Say why data that never changes helps when many jobs run

## Which languages are built around functions

Some languages are built around functions that take values in and hand new values back, without changing anything else. Haskell, Scala and Elixir are three of the best known. In them, a list is rarely changed in place. Doubling [1, 2, 3] gives a new list, [2, 4, 6], and the old one is still there.

That style matters most when a program does many jobs at once. If no job can change shared data, two jobs can never trip over each other halfway through a change. A whole family of hard bugs goes away. The cost is a different way of thinking, which takes time to learn.

Haskell, from 1990, is the strictest of the three. Functions in it can never change anything outside themselves unless the type says so. Its types are checked before it runs and are very powerful. It is popular in research and in some banks, and its ideas have spread into many other languages.

Scala mixes two styles: functional, and the object style that Java uses. It runs on the JVM, so it can use any Java code. That made it a common choice for big data tools. Apache Spark, a widely used tool for crunching huge data sets, is written in Scala.

Elixir runs on a virtual machine first built for phone networks that must never go down. It handles millions of tiny jobs at once. If one crashes, it is started again and the others never notice. That suits chat apps and live screens of data.

You do not need one of these to use their ideas. Python, JavaScript and Java all took map, filter and functions as values from them. Learning one of these makes you better in the one you use each day.

People think this style is just for research. But Elixir runs busy chat servers, and Scala moves data at big firms. It pays off when many jobs share the same data.

```haskell
doubled = map (* 2) [1, 2, 3]
-- [2,4,6]: a new list
-- the list [1, 2, 3] is never changed
```
map applies (* 2) to each item and hands back a new list. Nothing is changed in place.

![Four shelves of languages sorted by job. Data science: R, MATLAB and Julia. Functional: Haskell, Scala and Elixir, with the list [1, 2, 3] turned into a new list [2, 4, 6] and the old one marked unchanged. Shell and scripting: shell script, PowerShell, Perl and Lua, with a backup script printing done. Close to the hardware: assembly language and Objective-C.](https://learn.benibix.com/diagrams/dev4-language-families.svg)

### Example: Jack's chat server stops falling over

Jack's chat server holds 50,000 open connections. In his old code, one bad message could crash the whole process and drop everyone.

He rebuilds it in Elixir, where each link to a user is its own tiny job. Now a bad message crashes 1 link, which starts again in under a second.

**Words in this lesson:** [Haskell](https://learn.benibix.com/term/development/haskell), [Scala](https://learn.benibix.com/term/development/scala), [Elixir](https://learn.benibix.com/term/development/elixir)

**Question:** In a functional language, what does doubling the list [1, 2, 3] usually do?

**Answer:** It hands back a new list [2, 4, 6] and leaves the old one alone. Functional languages prefer new values over changed ones. The old list stays as it was, so nothing else that uses it is surprised.

---

Source: https://learn.benibix.com/learn/development-languages/haskell-scala-and-elixir
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
