PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Haskell

Haskell

Haskell is a programming language created in 1990 by Paul Hudak and John Hughes.

Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. The latest standard of Haskell is Haskell 2010. Read more on Wikipedia...

Try now: Riju ยท TIO ยท Replit

#21on PLDB 32Years Old 37.6kUsers

Example code from Riju:

module Main where main :: IO () main = putStrLn "Hello, world!"

Example code from hello-world:

module Main where main = putStrLn "Hello World"

Example code from the Hello World Collection:

-- Hello World in Haskell main = putStrLn "Hello World"

Example code from Linguist:

import Data.Char main :: IO () main = do let hello = "hello world" putStrLn $ map toUpper hello

Example code from Wikipedia:

$ ghci Prelude> import Data.Int Prelude Data.Int> fromIntegral (32767 :: Int16) :: Int8 -1 Prelude Data.Int> fromInteger (2^64 :: Integer) :: Int32 0

Keywords in Haskell

! ' '' - -< -<< -> :: ; <- , = => > ? # \* @ [|, |] \ \_ ` {, } {-, -} | ~ as case of class data family instance default deriving do forall foreign hiding if then else import infix infixl infixr let in mdo module newtype proc qualified rec type where

Language features

Feature Supported Example Token
Binary Literals โœ“
-- 0[bB]_*[01](_*[01])*
Integers โœ“
-- \d(_*\d)*
Floats โœ“
-- 0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*
Hexadecimals โœ“
-- 0[xX]_*[\da-fA-F](_*[\da-fA-F])*
Octals โœ“
-- 0[oO]_*[0-7](_*[0-7])*
Conditionals โœ“
Classes โœ“
Case Sensitivity โœ“
Print() Debugging โœ“ putStrLn
Range Operator โœ“
Function Composition โœ“
foo = f . g
Line Comments โœ“
-- A comment
--
Semantic Indentation โœ“
Operator Overloading โœ“
File Imports โœ“
import Data.Maybe
import Mod as Foo
import Mod (x,y, (+++))
import qualified Mod
import Mod hiding (x,y,(+++))
import qualified Mod hiding (x,y)
Directives โœ“
{-# INLINE foo #-}
Garbage Collection โœ“
Pattern Matching โœ“
fib 0 = 1
fib 1 = 1
fib n | n >= 2
      = fib (n-1) + fib (n-2)
Zippers โœ“
-- https://wiki.haskell.org/Zipper_monad/TravelTree
MultiLine Comments โœ“ {- -}
Comments โœ“
 -- a single line comment
 {- A multiline comment
    which can continue for many lines
 -}
Map Functions โœ“
class Functor f where
   fmap :: (a -> b) -> f a -> f b
   (<$) :: a -> f b -> f a
Monad โœ“
-- https://stackoverflow.com/questions/44965/what-is-a-monad
parseExpr = parseString <|> parseNumber

parseString = do
        char '"'
        x <- many (noneOf "\"")
        char '"'
        return (StringValue x)

parseNumber = do
    num <- many1 digit
    return (NumberValue (read num))
Typed Holes โœ“
-- Found hole `_' with type f (Free f b)
Runtime Guards โœ“
f x
 | x > 0 = 1
 | otherwise = 0
Strings โœ“
"hello world"
"

Trending Haskell repos on GitHub

repo stars description
shellcheck 16292 "ShellCheck a static analysis tool for shell scripts"
duckling 2567 "Language engine and tooling for expressing testing and evaluating composable language rules on input strings."
unison 2110 "Next generation programming language currently in development"

Books about Haskell on goodreads

title author year reviews ratings rating
Programming in Haskell Graham Hutton 2006 28 306 3.98
Haskell Programming From First Principles Christopher Allen 2015 22 130 4.55
Haskell: The Craft of Functional Programming Simon Thompson 1996 8 159 3.53
The Haskell Road to Logic, Maths and Programming Kees Doets 2004 5 110 3.67

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub