# Haskell

> A language where code works like maths and types are checked first.

**Field:** Software Development  
**Category:** Languages  
**Also known as:** Haskell Language, Haskell Programming

## Think of it like

It is like a maths book that a computer can run.

## Definition

Haskell is a purely functional programming language. Its functions work like maths: the same input always gives the same output, and nothing else changes. Every value has a type, checked before the program runs. The compiler can often work out the types for you. It is lazy, so it only works out a value when it is needed. It is loved for teaching and for code that must be right.

## Example

Lucy writes a function to square a number in Haskell, then maps it over a list. The result is [1,4,9].

## Example code

```haskell
square x = x * x
main = print (map square [1, 2, 3])   -- [1,4,9]
```

Square each number in a list, with no loop in sight.

## Why it matters

Many ideas in newer languages were tried in Haskell first. Map and pattern matching are two of them.

## Common mistake

Trying to change a variable. In Haskell values do not change, so you make a new one instead.

## Three principles

- **Pure functions.** Same input, same output.
- **Strong types.** Checked before it runs.
- **Lazy.** Work is done only when needed.

## Related terms

- [Functional Programming](https://learn.benibix.com/term/development/functional-programming)
- [Pure Function](https://learn.benibix.com/term/development/pure-function)
- [Immutability](https://learn.benibix.com/term/development/immutability)
- [Scala](https://learn.benibix.com/term/development/scala)
- [Elixir](https://learn.benibix.com/term/development/elixir)

## Taught in

- [Haskell, Scala and Elixir](https://learn.benibix.com/learn/development-languages/haskell-scala-and-elixir): Programming Languages, 11/12

![Four labelled shelves of languages. Data science: R, MATLAB and Julia, beside a small bar chart. Functional: Haskell, Scala, Elixir, beside an arrow that turns a list into a new list. Shell and scripting: shell script, PowerShell, Perl and Lua, beside a terminal prompt. Close to the hardware: assembly language and Objective-C, beside a chip and a phone.](https://learn.benibix.com/diagrams/dev4-language-families.svg)

---

Source: https://learn.benibix.com/term/development/haskell
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-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
