www.haskell.org Open in urlscan Pro
2604:1380:4641:a100::1  Public Scan

Submitted URL: http://1710369924455.breakablekisystem.com/8d31bc6f-23f6-4222-a715-d6dd5c67db06?n=2&t=1710369923760&l_next=ahr0chm6ly93d3cubgf0ywh1z28udg9w...
Effective URL: https://www.haskell.org/
Submission: On April 14 via api from US — Scanned from SG

Form analysis 0 forms found in the DOM

Text Content

 * Get started
 * Downloads
 * Playground
 * Community
 * Documentation
 * Donate






AN ADVANCED, PURELY FUNCTIONAL PROGRAMMING LANGUAGE




DECLARATIVE, STATICALLY TYPED CODE.

primes = filterPrime [2..] where
  filterPrime (p:xs) =
    p : filterPrime [x | x <- xs, x `mod` p /= 0]




Get started





TRY IT!

Try haskell requires Javascript to be enabled.
Try haskell requires cookies to be enabled.
Type Haskell expressions in here.
λ  


GOT 5 MINUTES?

Type help to start the tutorial.

Or try typing these out and see what happens (click to insert):

23 * 36 or reverse "hello" or foldr (:) [] [1,2,3]



VIDEOS


ESCAPE FROM THE IVORY TOWER: THE HASKELL JOURNEY, BY SIMON PEYTON-JONES

FUNCTIONAL PROGRAMMING & HASKELL, BY COMPUTERPHILE / JOHN HUGHES

PAST AND PRESENT OF HASKELL – INTERVIEW WITH SIMON PEYTON JONES

FUNCTIONAL PROGRAMMING IN HASKELL, BY GRAHAM HUTTON

WHAT IS A MONAD? BY COMPUTERPHILE / GRAHAM HUTTON

THE HASKELL UNFOLDER: DIJKSTRA'S SHORTEST PATHS, BY ANDRES LÖH AND EDSKO DE
VRIES


TESTIMONIALS

FOXHOUND SYSTEMS

AT FOXHOUND SYSTEMS, WE BUILD CUSTOM SOFTWARE FOR A VARIETY OF CLIENTS. HASKELL
IS OUR FIRST CHOICE FOR BUILDING PRODUCTION SYSTEMS BECAUSE IT IS UNRIVALED IN
THE COMBINATION OF DEVELOPER PRODUCTIVITY, MAINTAINABILITY, RELIABILITY, AND
PERFORMANCE THAT IT OFFERS.

--------------------------------------------------------------------------------

FISSION

HASKELL ENABLES FISSION TO BUILD ROCK SOLID, MAINTAINABLE, AND PERFORMANT
SERVICES AND TOOLS.

--------------------------------------------------------------------------------

MERCURY

MERCURY OFFERS BANKING FOR STARTUPS — AT ANY SIZE OR STAGE. WE USE HASKELL TO
MEET OUR CUSTOMERS' HIGH STANDARDS FOR CORRECTNESS AND SECURITY.

--------------------------------------------------------------------------------

FINN.NO

FINN.NO IS AN ONLINE CLASSIFIED AD SITE, AND WE USE HASKELL IN PRODUCTION. IT
ALLOWS US TO EXPRESS BUSINESS LOGIC WITH FOCUS ON CORRECTNESS AND WE BENEFIT
GREATLY FROM THE SAFE AND JOYFUL REFACTORING HASKELL BRINGS.

--------------------------------------------------------------------------------

CALABRIO

AT CALABRIO WE USE HASKELL TO BUILD OUR CUSTOMER INTELLIGENCE AND ANALYTICS
PLATFORM (CALABRIO ADVANCED REPORTING). HASKELL'S ROBUST TYPING AND SEMANTICS
OFFER US IMPORTANT GUARANTEES FOR OUR DATA OPERATIONS AND PROCESSES.

--------------------------------------------------------------------------------

SEROKELL

HASKELL ENABLES US TO BUILD RELIABLE, PERFORMANT, AND MAINTAINABLE APPLICATIONS
FOR OUR CLIENTS IN BIOTECH, FINTECH, AND BLOCKCHAIN.

--------------------------------------------------------------------------------

IMAGINE AI

IMAGINEAI IS A SMART CODE GENERATOR WRITTEN IN HASKELL THAT INSTANTLY TURNS YOUR
APP SPEC INTO CLEAN DJANGO AND NODE SOURCE CODE.

--------------------------------------------------------------------------------

E-BOT7

HASKELL ALLOWS US TO CREATE POWERFUL, RELIABLE SOFTWARE WITH CONFIDENCE. IT
ALLOWS US TO DETECT UNWANTED BEHAVIOR BEFORE IT SHOWS UP IN OUR PRODUCTION
ENVIRONMENT.

--------------------------------------------------------------------------------

SCARF

HASKELL POWERS SCARF'S BACKEND, HELPING US MOVE FAST AND NOT BREAK THINGS. IT
OFFERS UNPARALLELED MAINTAINABILITY, SO WE CAN QUICKLY AND SAFELY ADAPT OUR
SYSTEM TO THE MOVING TARGET OF CUSTOMER DEMANDS.

--------------------------------------------------------------------------------

IOHK

SMART CONTRACT SYSTEMS ARE LARGELY ABOUT PROGRAMMING LANGUAGES, AND WHEN IT
COMES TO PROGRAMMING LANGUAGES WORK THERE IS NO COMPETITOR TO HASKELL.

--------------------------------------------------------------------------------

HASURA

HASKELL IS AN IDEAL PROTOTYPING TOOL, WHEN WE WANT TO BUILD AN MVP AND GET A
PROTOTYPE OUT AS QUICKLY AS POSSIBLE...HASKELL LETS US BE PRECISE WHEN WE NEED
TO BE, AND FAST WHEN WE WANT TO BE.

--------------------------------------------------------------------------------

CENTRALAPP

WE USE HASKELL... BECAUSE SOLVING COMPLEX PROBLEMS WELL REQUIRES THE BEST TOOLS
IN THE BUSINESS.

--------------------------------------------------------------------------------

BITNOMIAL

HASKELL GIVES US HUGE LEVERAGE OVER OUR COMPLEX BUSINESS DOMAIN WHILE ALLOWING
US TO STAY NIMBLE AND INNOVATE. THE TYPE SYSTEM ALLOWS US TO INTEGRATE NEW
KNOWLEDGE QUICKLY AND REFACTOR OUR SIZEABLE CODE BASE WITH RELATIVE EASE.

--------------------------------------------------------------------------------

BELLROY

WE'VE FOUND THE STABILITY, MAINTAINABILITY AND PERFORMANCE OF HASKELL TO BE
EXCEPTIONAL AND WE LOOK FORWARD TO MORE OF THAT IN THE YEARS TO COME.

--------------------------------------------------------------------------------

NOREDINK

THE HIGHEST-TRAFFIC FEATURES OF NOREDINK.COM ARE NOW SERVED VIA HASKELL. WE'VE
SEEN A HUGE PERFORMANCE IMPROVEMENT COMPARED TO WHAT WAS PREVIOUSLY DOING THAT
WORK AS WELL AS A MASSIVE REDUCTION IN PRODUCTION ERROR RATES.

--------------------------------------------------------------------------------

STACK BUILDERS

HASKELL MAKES IT POSSIBLE TO MAINTAIN AN EDTECH PLATFORM IN 23 LANGUAGES FOR
MORE THAN 70K USERS FROM ONE OF THE LARGEST MULTINATIONAL FINANCIAL SERVICES
CORPORATIONS.

--------------------------------------------------------------------------------

« »



FEATURES


STATICALLY TYPED

Every expression in Haskell has a type which is determined at compile time. All
the types composed together by function application have to match up. If they
don't, the program will be rejected by the compiler. Types become not only a
form of guarantee, but a language for expressing the construction of programs.

Click to expand

All Haskell values have a type:

char = 'a'    :: Char
int = 123     :: Int
fun = isDigit :: Char -> Bool


You have to pass the right type of values to functions, or the compiler will
reject the program:

Type error

isDigit 1

You can decode bytes into text:

bytes = Crypto.Hash.SHA1.hash "hello" :: ByteString
text = decodeUtf8 bytes               :: Text


But you cannot decode Text, which is already a vector of Unicode points:

Type error

doubleDecode = decodeUtf8 (decodeUtf8 bytes)


PURELY FUNCTIONAL

Every function in Haskell is a function in the mathematical sense (i.e.,
"pure"). Even side-effecting IO operations are but a description of what to do,
produced by pure code. There are no statements or instructions, only expressions
which cannot mutate variables (local or global) nor access state like time or
random numbers.

Click to expand

The following function takes an integer and returns an integer. By the type it
cannot do any side-effects whatsoever, it cannot mutate any of its arguments.

square :: Int -> Int
square x = x * x

The following string concatenation is okay:

"Hello: " ++ "World!" 

The following string concatenation is a type error:

Type error

"Name: " ++ getLine

Because getLine has type IO String and not String, like "Name: " is. So by the
type system you cannot mix and match purity with impurity.


TYPE INFERENCE

You don't have to explicitly write out every type in a Haskell program. Types
will be inferred by unifying every type bidirectionally. However, you can write
out types if you choose, or ask the compiler to write them for you for handy
documentation.

Click to expand

This example has a type signature for every binding:

main :: IO ()
main = do line :: String <- getLine
          print (parseDigit line)
  where parseDigit :: String -> Maybe Int
        parseDigit ((c :: Char) : _) =
          if isDigit c
             then Just (ord c - ord '0')
             else Nothing

But you can just write:

main = do line <- getLine
          print (parseDigit line)
  where parseDigit (c : _) =
          if isDigit c
             then Just (ord c - ord '0')
             else Nothing

You can also use inference to avoid wasting time explaining what you want:

do ss <- decode "[\"Hello!\",\"World!\"]"
   is <- decode "[1,2,3]"
   return (zipWith (\s i -> s ++ " " ++ show (i + 5)) ss is)
 => Just ["Hello! 6","World! 7"]

Types give a parser specification for free, the following input is not accepted:

do ss <- decode "[1,2,3]"
   is <- decode "[null,null,null]"
   return (zipWith (\s i -> s ++ " " ++ show (i + 5)) ss is)
 => Nothing


CONCURRENT

Haskell lends itself well to concurrent programming due to its explicit handling
of effects. Its flagship compiler, GHC, comes with a high-performance parallel
garbage collector and light-weight concurrency library containing a number of
useful concurrency primitives and abstractions.

Click to expand

Easily launch threads and communicate with the standard library:

main = do
  done <- newEmptyMVar
  forkIO (do putStrLn "I'm one thread!"
             putMVar done "Done!")
  second <- forkIO (do threadDelay 100000
                       putStrLn "I'm another thread!")
  killThread second
  msg <- takeMVar done
  putStrLn msg

Use an asynchronous API for threads:

do a1 <- async (getURL url1)
  a2 <- async (getURL url2)
  page1 <- wait a1
  page2 <- wait a2
  ...

Atomic threading with software transactional memory:

transfer :: Account -> Account -> Int -> IO ()
transfer from to amount =
  atomically (do deposit to amount
                 withdraw from amount)

Atomic transactions must be repeatable, so arbitrary IO is disabled in the type
system:

Type error

main = atomically (putStrLn "Hello!")


LAZY

Functions don't evaluate their arguments. This means that programs can compose
together very well, with the ability to write control constructs (such as
if/else) just by writing normal functions. The purity of Haskell code makes it
easy to fuse chains of functions together, allowing for performance benefits.

Click to expand

Define control structures easily:

when p m = if p then m else return ()
main = do args <- getArgs
          when (null args)
               (putStrLn "No args specified!") 

If you notice a repeated expression pattern, like

if c then t else False

you can give this a name, like

and c t = if c then t else False

and then use it with the same effect as the original expression.

Get code re-use by composing lazy functions. It's quite natural to express the
any function by reusing the map and or functions:

any :: (a -> Bool) -> [a] -> Bool
any p = or . map p

Reuse the recursion patterns in map, filter, foldr, etc.


PACKAGES

Open source contribution to Haskell is very active with a wide range of packages
available on the public package servers.

Click to expand

There are 6,954 packages freely available. Here is a sample of the most common
ones:

bytestring Binary data base Prelude, IO, threads network Networking text Unicode
text parsec Parser library directory File/directory hspec RSpec-like tests
attoparsec Fast parser monad-logger Logging persistent Database ORM
template-haskell Meta-programming tar Tar archives snap Web framework time Date,
time, etc. happstack Web framework yesod Web framework containers Maps, graphs,
sets fsnotify Watch filesystem hint Interpret Haskell unix UNIX bindings SDL SDL
binding OpenGL OpenGL graphics system criterion Benchmarking pango Text
rendering cairo Cairo graphics statistics Statistical analysis gtk Gtk+ library
glib GLib library test-framework Testing framework resource-pool Resource
pooling conduit Streaming I/O mwc-random High-quality randoms QuickCheck
Property testing stm Atomic threading blaze-html Markup generation cereal Binary
parsing/printing xml XML parser/printer http-client HTTP client engine zlib
zlib/gzip/raw yaml YAML parser/printer pandoc Markup conversion binary
Serialization tls TLS/SSL zip-archive Zip compression warp Web server text-icu
Text encodings vector Vectors async Async concurrency pipes Streaming IO
scientific Arbitrary-prec. nums process Launch processes aeson JSON
parser/printer dlist Difflists syb Generic prog.



SPONSORS

Fastly's Next Generation CDN provides low latency access for all of
Haskell.org's downloads and highest traffic services, including the primary
Hackage server, Haskell Platform downloads, and more.

Status.io powers https://status.haskell.org, and lets us easily tell you when we
broke something.

Equinix Metal provides compute, storage, and networking resources, powering
almost all of Haskell.org in several regions around the world.

DreamHost has teamed up to provide Haskell.org with redundant, scalable
object-storage through their Dream Objects service.

Galois provides infrastructure, funds, administrative resources and has
historically hosted critical Haskell.org infrastructure, as well as helping the
Haskell community at large with their work.

Scarf provides data and insights on the adoption of Haskell in order to support
efforts to grow the Haskell ecosystem and facilitate industry support for the
language.


HASKELL.ORG

Hosted and managed by Haskell.org, a 501(c)(3) non-profit.


PSST! LOOKING FOR THE WIKI?

This is the new Haskell home page! The wiki has moved to wiki.haskell.org.

© 2014–2024 haskell.org



Got changes to contribute to the site?
Fork or comment on GitHub



Hosted on