Title
Haskell Language
Go Home
Category
Description
Address
Phone Number
+1 609-831-2326 (US) | Message me
Site Icon
Haskell Language
Page Views
0
Share
Update Time
2022-05-03 00:46:15

"I love Haskell Language"

www.haskell.org VS www.gqak.com

2022-05-03 00:46:15

Downloads Community Documentation Donate An advanced, purely functional programming language Declarative, statically typed code. primes = filterPrime [2..] where filterPrime (p:xs) = p : filterPrime [x | x 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" :: ByteStringtext = 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 -> Intsquare 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 Maybe Int parseDigit ((c :: Char) : _) = if isDigit c then Just (ord c - ord '0') else Nothing But you can just write: main = do line Bool) -> [a] -> Boolany 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 DataDog provides powerful, customizable 24/7 metrics and monitoring integration for all of Haskell.org, and complains loudly for us when things go wrong. 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. Equinix Metal provides compute, storage, and networking resources, powering almost all of Haskell.org in several regions around the world. Status.io powers https://status.haskell.org, and lets us easily tell you when we broke something. 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. DreamHost has teamed up to provide Haskell.org with redundant, scalable object-storage through their Dream Objects service. 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–2022 haskell.org Got changes to contribute to the site? Fork or comment on GitHub Hosted on