Skip to content
Search

Haskell

lastmod 2025-12-08created 2015-05-0542 edits

Haskell (Korean: 하스켈 haseukel or 해스켈 haeseukel; English: Haskell IPA: [ˈhæskəl]) is a purely functional programming language.

It is named after the logician Haskell Curry. So it should properly be called '해스켈' (haeseukel), but in South Korea '하스켈' (haseukel) has become widely established as the name of the programming language.

How to install

macOS

$ brew install ghc cabal-install haskell-stack

Category

Projects

  • diagrams - Embedded domain-specific language for declarative vector graphics
  • xmonad - Tiling X11 Window Manager (Haskell version of dwm)
  • xmobar - A minimalistic text-based status bar

List of haskell classes

Dollar operator ($)

The $ operator is often used in place of parentheses.

λ> :t ($)
($) :: (a -> b) -> a -> b
λ> putStrLn ("A" ++ "Z")
AZ
λ> putStrLn $ "A" ++ "Z"
AZ

Since the $ operator is an infix operator, ($ "Z") behaves just like (\f -> f "Z").

λ> map (\f -> f "Z") [('A':), ('B':)]
["AZ","BZ"]
λ> map ($ "Z") [('A':), ('B':)]
["AZ","BZ"]

Examples

String concatenation

Use ++.

(++) :: String -> String -> String

Example:

Prelude> "aa" ++ "bb"
"aabb"

String length

Prelude> length "haha"
4

List/tuple access

  • fst: Gets the first element.
  • snd: Gets the second element.
  • head: Evaluates to the first element of a list
  • tail: Returns the rest of a list excluding the first element.

Favorite site

Tutorials

Guide

Haskell for C programmers

author Zer0 sitemap