Jump to content

Haskell: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Examples: note about parameter syntax to clarify
 
Line 1: Line 1:
{{Short description|Functional programming language}}
'''Haskell''' is a standardized [[functional_programming|functional]] [[programming language]] with [[non-strict programming language|non-strict semantics]], named after the logician [[Haskell Curry]]. It was created by a committee formed in the [[1980s]] for the express purpose of defining such a language.
{{Other uses}}
The latest semi-official language standard is '''Haskell 98''', intended to specify a minimal, portable version of the language for teaching and as a base for future extensions.
{{Use dmy dates|date=November 2019}}
The language continues to evolve rapidly, with [[Hugs]] and [[Glasgow Haskell Compiler|GHC]] (see below) representing the current ''[[de facto]]'' standard.
{{Infobox programming language
| name = Haskell
| logo = Logo of the Haskell programming language.svg
| logo size = 250px
| logo alt = Logo of Haskell
| paradigm = [[Purely functional programming|Purely functional]]
| released = {{Start date and age|1990|df=yes}}{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007}}
| designer = [[Lennart Augustsson]], Dave Barton, Brian Boutel, Warren Burton, Joseph Fasel, Kevin Hammond, Ralf Hinze, [[Paul Hudak]], [[John Hughes (computer scientist)|John Hughes]], Thomas Johnsson, Mark Jones, [[Simon Peyton Jones]], [[John Launchbury]], [[Erik Meijer (computer scientist)|Erik Meijer]], John Peterson, Alastair Reid, Colin Runciman, [[Philip Wadler]]
| developer =
| latest release version = <!-- Of language specification, not Haskell Platform! -->Haskell 2010<ref name="2010ann">{{cite mailing list |url=http://www.haskell.org/pipermail/haskell/2009-November/021750.html |title=Announcing Haskell 2010 |date=24 November 2009 |access-date=12 March 2011 |mailing-list=Haskell |last1=Marlow |first1=Simon |author1-link=Simon Marlow}}</ref>
| latest release date = {{Start date and age|2010|07|df=yes}}
| latest test version = Haskell 2020 announced<ref name="2020committee">{{cite mailing list|url=https://mail.haskell.org/pipermail/haskell-prime/2016-April/004050.html |title=ANN: Haskell Prime 2020 committee has formed |date=28 April 2016 |access-date=6 May 2017 |mailing-list=Haskell-prime |last1=Riedel |first1=Herbert}}</ref>
| latest test date =
| typing = [[Type inference|Inferred]], [[static typing|static]], [[Strong and weak typing|strong]]
| implementations = [[Glasgow Haskell Compiler|GHC]], [[Hugs (interpreter)|Hugs]], NHC, JHC, [[Yhc]], UHC
| dialects = [[Gofer (software)|Gofer]]
| influenced by = [[Clean (programming language)|Clean]],<ref name="haskell-report-influences">{{harvnb|Peyton Jones|2003|p=xi}}</ref> [[FP (programming language)|FP]],<ref name="haskell-report-influences"/> [[Gofer (programming language)|Gofer]],<ref name="haskell-report-influences"/> [[Hope (programming language)|Hope]] and Hope<sup>+</sup>,<ref name="haskell-report-influences"/> [[Id (programming language)|Id]],<ref name="haskell-report-influences"/> [[ISWIM]],<ref name="haskell-report-influences"/> [[Kent Recursive Calculator|KRC]],<ref name="haskell-report-influences"/> [[Lisp (programming language)|Lisp]],<ref name="haskell-report-influences"/><br/>[[Miranda (programming language)|Miranda]],<ref name="haskell-report-influences"/> [[ML (programming language)|ML]] and [[Standard ML]],<ref name="haskell-report-influences"/> [[Orwell (programming language)|Orwell]], [[SASL (programming language)|SASL]],<ref name="haskell-report-influences"/> [[Scheme (programming language)|Scheme]],<ref name="haskell-report-influences"/> [[SISAL]]<ref name="haskell-report-influences"/>
| influenced = [[Agda (programming language)|Agda]],<ref>{{cite web|url=http://www.cse.chalmers.se/~ulfn/papers/afp08/tutorial.pdf|title=Dependently Typed Programming in Agda|last1=Norell|first1=Ulf|year=2008|publisher=Chalmers University|access-date=9 February 2012|location=Gothenburg}}</ref> [[Bluespec]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12–38, 43}} [[C++11]]/[[Concepts (C++)|Concepts]],<ref>{{cite journal|title=Design of Concept Libraries for C++ |last1=Stroustrup |first1=Bjarne |author1-link=Bjarne Stroustrup |last2=Sutton |first2=Andrew |url=http://www2.research.att.com/~bs/sle2011-concepts.pdf |year=2011 |url-status=dead |archive-url=https://web.archive.org/web/20120210041742/http://www2.research.att.com/~bs/sle2011-concepts.pdf |archive-date=10 February 2012 |journal=Software Language Engineering}}</ref><br/>[[C Sharp (programming language)|C#]]/[[Language Integrated Query|LINQ]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}}<ref name="meijer2012"/><ref>{{cite web|url=http://channel9.msdn.com/shows/Going+Deep/Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1/|title=C9 Lectures: Dr. Erik Meijer&nbsp;– Functional Programming Fundamentals, Chapter 1 of 13|last=Meijer|first=Erik|date=1 October 2009|work=[[Channel 9 (discussion forum)|Channel 9]]|publisher=Microsoft|access-date=9 February 2012|archive-date=16 June 2012|archive-url=https://web.archive.org/web/20120616051226/http://channel9.msdn.com/shows/Going+Deep/Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1/|url-status=dead}}</ref><ref>{{cite news|last1=Drobi|first1=Sadek|date=4 March 2009|url=http://www.infoq.com/interviews/LINQ-Erik-Meijer|title=Erik Meijer on LINQ|work=InfoQ|publisher=C4Media Inc.|access-date=9 February 2012|location=QCon [[San Francisco|SF]] 2008}}</ref> CAL,{{Citation needed|date=February 2012}} [[Cayenne (programming language)|Cayenne]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[Clean (programming language)|Clean]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[Clojure]],<ref>{{cite web |url=https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |archive-url=https://web.archive.org/web/20171003001051/https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |url-status=dead |archive-date=3 October 2017 |title=Clojure Bookshelf |last=Hickey |first=Rich |work=Listmania! |access-date=3 October 2017}}</ref><br/>[[CoffeeScript]],<ref>{{cite news |last1=Heller |first1=Martin |date=2011-10-18 |df=dmy |url=https://www.infoworld.com/article/2078452/turn-up-your-nose-at-dart-and-smell-the-coffeescript.html |title=Turn up your nose at Dart and smell the CoffeeScript |work=[[InfoWorld]] |access-date=2020-07-15}}</ref> [[Curry (programming language)|Curry]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[Elm (programming language)|Elm]],<br/>[[Epigram (programming language)|Epigram]],{{Citation needed|date=February 2012}} [[Escher (programming language)|Escher]],<ref>{{cite web|url=http://www.cs.bris.ac.uk/Publications/Papers/1000073.pdf|title=Declarative programming in Escher|access-date=7 October 2015}}</ref> [[F Sharp (programming language)|F#]],<ref>{{cite book|last1=Syme|first1=Don|author-link1=Don Syme|last2=Granicz|first2=Adam|last3=Cisternino|first3=Antonio|title=Expert F#|year=2007|publisher=[[Apress]]|page=2 |quote=F# also draws from Haskell particularly with regard to two advanced language features called ''sequence expressions'' and ''workflows''.}}</ref> [[Hack (programming language)|Hack]],<ref>{{cite magazine|url=https://www.wired.com/2014/03/facebook-hack/|title=Facebook Introduces 'Hack,' the Programming Language of the Future|date=20 March 2014|magazine=WIRED}}</ref> [[Idris (programming language)|Idris]],<ref>{{cite web|title=Idris, a dependently typed language|url=http://www.idris-lang.org/|access-date=26 October 2014}}</ref><br/>[[Isabelle (proof assistant)|Isabelle]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[Java (programming language)|Java]]/[[Generics in Java|Generics]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[LiveScript (programming language)|LiveScript]],<ref>{{cite web|url=http://livescript.net/#inspiration|title=LiveScript Inspiration|access-date=4 February 2014}}</ref><br/>[[Mercury (programming language)|Mercury]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}} [[Ωmega]], [[PureScript]],<ref>{{cite web|url=https://leanpub.com/purescript/read|title=PureScript by Example|last=Freeman|first=Phil|year=2016|publisher=Leanpub|access-date=23 April 2017}}</ref> [[Python (programming language)|Python]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}}<ref>{{cite web|url=https://docs.python.org/howto/functional.html|title=Functional Programming HOWTO|last=Kuchling|first=A. M.|work=Python v2.7.2 documentation|publisher=Python Software Foundation|access-date=9 February 2012}}</ref> [[Raku (programming language)|Raku]],<ref>{{cite web|url=http://www.perlfoundation.org/perl6/index.cgi?glossary_of_terms_and_jargon|title=Glossary of Terms and Jargon|work=Perl Foundation Perl 6 Wiki|publisher=[[The Perl Foundation]]|access-date=9 February 2012|archive-url=https://web.archive.org/web/20120121145808/http://www.perlfoundation.org/perl6/index.cgi?glossary_of_terms_and_jargon|archive-date=21 January 2012|url-status=dead}}</ref><br/>[[Rust (programming language)|Rust]],<ref>{{Cite web |url=https://doc.rust-lang.org/reference/influences.html |title=Influences - The Rust Reference |website=The Rust Reference |access-date=2023-12-31}}</ref> [[Scala (programming language)|Scala]],{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}}<ref>{{cite web|url=http://blog.fogus.me/2010/08/06/martinodersky-take5-tolist/|title=MartinOdersky take(5) toList|last=Fogus|first=Michael|date=6 August 2010|work=Send More Paramedics|access-date=9 February 2012}}</ref> [[Swift (programming language)|Swift]],<ref name="lattner2014">{{cite web|url=http://nondot.org/sabre/|title=Chris Lattner's Homepage|last=Lattner|first=Chris|date=3 June 2014|access-date=3 June 2014|publisher=Chris Lattner|quote=The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.}}</ref><br/>[[Visual Basic (.NET)|Visual Basic 9.0]]{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12-45–46}}<ref name="meijer2012">{{cite journal|last1=Meijer|first1=Erik|author1-link=Erik Meijer (computer scientist)|title=Confessions of a Used Programming Language Salesman: Getting the Masses Hooked on Haskell|journal=Oopsla 2007|citeseerx=10.1.1.72.868|year=2006}}</ref>
| operating system = [[Cross-platform]]
| license =
| website = {{URL|haskell.org}}
| file ext = .hs, .lhs
}}


'''Haskell''' ({{IPAc-en|ˈ|h|æ|s|k|əl}}<ref>{{cite mailing list |url=http://www.haskell.org/pipermail/haskell-cafe/2008-January/038756.html |title=anybody can tell me the pronunciation of "haskell"? |date=28 January 2008 |access-date=12 March 2011 |mailing-list=Haskell-cafe |last=Chevalier |first=Tim}}</ref>) is a [[General-purpose programming language|general-purpose]], [[static typing|statically-typed]], [[purely functional programming|purely functional]] [[programming language]] with [[type inference]] and [[lazy evaluation]].<ref>Type inference originally using [[Type inference#Hindley–Milner type inference algorithm|Hindley-Milner type inference]]</ref>{{sfn|Peyton Jones|2003}} Designed for teaching, research, and industrial applications, Haskell has pioneered several programming language [[#Features|features]] such as [[type class]]es, which enable [[type safety|type-safe]] [[operator overloading]], and [[Monad (functional programming)|monadic]] [[input/output]] (IO). It is named after [[logic]]ian [[Haskell Curry]].{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007}} Haskell's main implementation is the [[Glasgow Haskell Compiler]] (GHC).
Interesting Haskell features include support for [[recursion|recursive]] functions and datatypes, [[pattern matching]], [[list comprehension]]s and [[guard statement]]s.
The combination of such features can make [[function (programming)|functions]] which would be difficult to write in a procedural programming language almost trivial to implement in Haskell.
The language is, as of 2002, the [[functional programming language|functional language]] on which the most research is being performed. Several variants have been developed: parallelizable versions from [[Massachusetts Institute of Technology|MIT]] and [[Glasgow University|Glasgow]], both called Parallel Haskell; more parallel and distributed versions called Distributed Haskell (formerly Goffin) and [[Eden_programming_language|Eden]]; a [[speculative execution|speculatively evaluating]] version called Eager Haskell and several [[object orientation|object oriented]] versions: Haskell++, [[O'Haskell]] and [[Mondrian programming language|Mondrian]].


Haskell's [[Semantics (computer science)|semantics]] are historically based on those of the [[Miranda (programming language)|Miranda]] programming language, which served to focus the efforts of the initial Haskell working group.<ref>Edward Kmett, [https://www.youtube.com/watch?v=hIZxTQP1ifo Edward Kmett – Type Classes vs. the World]</ref> The last formal specification of the language was made in July 2010, while the development of GHC continues to expand Haskell via language extensions.
Although Haskell has a comparetively small user community, its strengths have been well applied to a few projects. [[Autrijus Tang]]'s [[Pugs]] is an interpreter and compiler for the Perl 6 language, completed in a few months. [[DARCS]] is a revision controll system, with several inovative features.


Haskell is used in academia and industry.<ref>{{Citation|last=Mossberg|first=Erik|title=erkmos/haskell-companies|date=2020-06-08|url=https://github.com/erkmos/haskell-companies|access-date=2020-06-22}}</ref><ref>{{cite book |last1=O'Sullivan |first1=Bryan |last2=Goerzen |first2=John |last3=Stewart |first3=Donald Bruce |title=Real World Haskell: Code You Can Believe In |date=15 November 2008 |publisher="O'Reilly Media, Inc." |isbn=978-0-596-55430-9 |pages=xxviii-xxxi |url=https://books.google.com/books?id=nh0okI1a1sQC |language=en}}</ref><ref>{{cite web|title=Haskell in Production: Riskbook|url=https://serokell.io/blog/haskell-in-industry-riskbook|access-date=2021-09-07|website=Serokell Software Development Company|language=en}}</ref> {{As of|2021|May}}, Haskell was the 28th most popular programming language by [[Google search]]es for tutorials,<ref>{{cite web|last=|first=|date=May 2021|title=PYPL PopularitY of Programming Language index|url=http://pypl.github.io/PYPL.html|url-status=dead|archive-url=https://web.archive.org/web/20210507222106/https://pypl.github.io/PYPL.html|archive-date=7 May 2021|access-date=16 May 2021|website=pypl.github.io|language=en}}</ref> and made up less than 1% of active users on the [[GitHub]] source code repository.<ref>{{cite web|url=https://www.benfrederickson.com/ranking-programming-languages-by-github-users/|title=Ranking Programming Languages by GitHub Users|last=Frederickson|first=Ben|website=www.benfrederickson.com|access-date=6 September 2019}}</ref>
There is also a Haskell-like language that offers a new method of support for [[GUI]] development called [[Clean programming language|Concurrent Clean]]. Its biggest deviation from Haskell is in the use of [[uniqueness type]]s for input as opposed to [[Monads in functional programming|monads]].


== Examples ==
== History ==
The "Hello World" of functional languages is the factorial function. Expressed as pure Haskell:


After the release of [[Miranda (programming language)|Miranda]] by Research Software Ltd. in 1985, interest in lazy functional languages grew. By 1987, more than a dozen non-[[strict function|strict]], purely functional programming languages existed. Miranda was the most widely used, but it was [[proprietary software]]. At the conference on [[Functional Programming Languages and Computer Architecture]] (FPCA '87) in [[Portland, Oregon]], there was a strong consensus that a committee be formed to define an [[open standard]] for such languages. The committee's purpose was to consolidate existing [[functional languages]] into a common one to serve as a basis for future research in functional-language design.{{sfn|Peyton Jones|2003|loc=Preface}}
fac 0 = 1
fac n = n * fac (n-1)


=== Haskell 1.0 to 1.4 ===
This is similar to how a math textbook defines factorials, as is much Haskell dealing with math. Notably, parameters of a function are not in parentheses but simply separated by spaces.


Haskell was developed by a committee, attempting to bring together off the shelf solutions where possible.
The "Prelude" is a number of small functions analogous to C's standard library. Using the prelude and writing in the "point free" (insert classic Haskell joke here) style of unspecified arguments, it becomes:


[[Type classes]], which enable [[type safety|type-safe]] [[operator overloading]], were first proposed by [[Philip Wadler]] and Stephen Blott to address the ad-hoc handling of equality types and arithmetic overloading in languages at the time.<ref>{{cite web|url=https://www.researchgate.net/publication/2710954|title=How to make ad-hoc polymorphism less ad hoc|last=Wadler|first=Philip|date=October 1988}}</ref>
fac = product . enumFromTo 1


In early versions of Haskell up until and including version 1.2, user interaction and [[input/output]] (IO) were handled by both streams based and continuation based mechanisms which were widely considered unsatisfactory.<ref>{{cite web|url=https://www.microsoft.com/en-us/research/publication/wearing-hair-shirt-retrospective-haskell-2003/|title=Wearing the hair shirt: a retrospective on Haskell|last=Peyton Jones|first=Simon|website=[[Microsoft]] |date=2003|ref=none}}</ref> In version 1.3, [[Monad (functional programming)|monadic]] IO was introduced, along with the generalisation of type classes to higher kinds (type constructors). Along with "do notation", which provides syntactic sugar for the Monad type class, this gave Haskell an effect system that maintained referential transparency and was convenient.
The '.' in the above is the '.' from [[Lambda calculus]], a core part of functional programming. Note also that the '=' is the '=' of <math>f(x)=x^{2}</math>.


Other notable changes in early versions were the approach to the 'seq' function, which creates a data dependency between values, and is used in lazy languages to avoid excessive memory consumption; with it moving from a type class to a standard function to make refactoring more practical.
A simple [[RPN]] calculator:


The first version of Haskell ("Haskell 1.0") was defined in 1990.{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007}} The committee's efforts resulted in a series of language definitions (1.0, 1.1, 1.2, 1.3, 1.4).
calc = foldl f [] . words
where
f (x:y:zs) "+" = y+x:zs
f (x:y:zs) "-" = y-x:zs
f (x:y:zs) "*" = y*x:zs
f (x:y:zs) "/" = y/x:zs
f xs y = (read y :: Float):xs


[[File:Base-classes.svg|thumb|right|Hierarchy of [[type class]]es in the Haskell prelude as of GHC 7.10.
A function which returns a stream of the [[Fibonacci numbers]] in linear time:


The inclusion of Foldable and Traversable (with corresponding changes to the type signatures of some functions), and of Applicative as intermediate between Functor and Monad, are deviations from the Haskell 2010 standard.]]
fibs@(_:rest) = 0 : 1 : (zipWith (+) fibs rest)


=== Haskell 98 ===
A remarkably concise function that returns the list of [[Hamming number]]s in order:


In late 1997, the series culminated in ''Haskell 98'', intended to specify a stable, minimal, portable version of the language and an accompanying standard [[library (computer science)|library]] for teaching, and as a base for future extensions. The committee expressly welcomed creating extensions and variants of Haskell 98 via adding and incorporating experimental features.{{sfn|Peyton Jones|2003|loc=Preface}}
hamming = 1 : map (*2) hamming # map (*3) hamming # map (*5) hamming

where xxs@(x:xs) # yys@(y:ys)
In February 1999, the Haskell 98 language standard was originally published as ''The Haskell 98 Report''.{{sfn|Peyton Jones|2003|loc=Preface}} In January 2003, a revised version was published as ''Haskell 98 Language and Libraries: The Revised Report''.{{sfn|Peyton Jones|2003}} The language continues to evolve rapidly, with the [[Glasgow Haskell Compiler]] (GHC) implementation representing the current ''de facto'' standard.<ref name=HaskellWikiImpl>{{cite web|title=Haskell Wiki: Implementations|url=http://www.haskell.org/haskellwiki/Implementations|access-date=18 December 2012}}</ref>
| x==y = x : xs#ys

| x<y = x : xs#yys
=== Haskell 2010 ===
| x>y = y : xxs#ys

In early 2006, the process of defining a successor to the Haskell 98 standard, informally named ''Haskell Prime'', began.<ref>{{cite web|url=https://prime.haskell.org/|title=Welcome to Haskell'|work=The Haskell' Wiki|access-date=11 February 2016|archive-date=20 February 2016|archive-url=https://web.archive.org/web/20160220103915/https://prime.haskell.org/|url-status=dead}}</ref> This was intended to be an ongoing incremental process to revise the language definition, producing a new revision up to once per year. The first revision, named ''Haskell 2010'', was announced in November 2009<ref name="2010ann"/> and published in July 2010.

Haskell 2010 is an incremental update to the language, mostly incorporating several well-used and uncontroversial features previously enabled via compiler-specific flags.
* Hierarchical module names. Module names are allowed to consist of dot-separated sequences of capitalized identifiers, rather than only one such identifier. This lets modules be named in a hierarchical manner (e.g., <code>Data.List</code> instead of <code>List</code>), although technically modules are still in a single monolithic namespace. This extension was specified in an addendum to Haskell 98 and was in practice universally used.
* The [[foreign function interface]] (FFI) allows bindings to other programming languages. Only bindings to [[C (programming language)|C]] are specified in the Report, but the design allows for other language bindings. To support this, data type declarations were permitted to contain no constructors, enabling robust nonce types for foreign data that could not be constructed in Haskell. This extension was also previously specified in an Addendum to the Haskell 98 Report and widely used.
* So-called ''n''+''k'' patterns (definitions of the form <code>fact (n+1) = (n+1) * fact n</code>) were no longer allowed. This [[syntactic sugar]] had misleading semantics, in which the code looked like it used the <code>(+)</code> operator, but in fact desugared to code using <code>(-)</code> and <code>(>=)</code>.
* The rules of [[type inference]] were relaxed to allow more programs to type check.
* Some [[Syntax (programming languages)|syntax]] issues (changes in the formal grammar) were fixed: [[pattern guard]]s were added, allowing pattern matching within guards; resolution of [[Order of operations|operator fixity]] was specified in a simpler way that reflected actual practice; an edge case in the interaction of the language's [[lexical syntax]] of operators and comments was addressed, and the interaction of do-notation and if-then-else was tweaked to eliminate unexpected syntax errors.
* The <code>LANGUAGE</code> [[Directive (programming)|pragma]] was specified. By 2010, dozens of extensions to the language were in wide use, and GHC (among other compilers) provided the <code>LANGUAGE</code> pragma to specify individual extensions with a list of identifiers. Haskell 2010 compilers are required to support the <code>Haskell2010</code> extension and are encouraged to support several others, which correspond to extensions added in Haskell 2010.

=== Future standards ===

The next formal specification had been planned for 2020.<ref name="2020committee"/> On 29 October 2021, with GHC version 9.2.1, the GHC2021 extension was released. While this is not a formal language spec, it combines several stable, widely-used GHC extensions to Haskell 2010.<ref name= ghc9,2,1>GHC 2020 Team (29 October 2021) [https://downloads.haskell.org/~ghc/9.2.1/docs/html/users_guide/9.2.1-notes.html GHC 9.2.1] released</ref><ref>[https://github.com/ghc-proposals/ghc-proposals Proposed compiler and language changes for GHC and GHC/Haskell ]</ref>

== Features ==
{{Main|Haskell features}}
{{See also|Glasgow Haskell Compiler#Extensions to Haskell}}

Haskell features [[lazy evaluation]], [[Anonymous function|lambda expressions]], [[pattern matching]], [[list comprehension]], [[type class]]es and [[type polymorphism]]. It is a [[purely functional programming]] language, which means that functions generally have no [[Side effect (computer science)|side effects]]. A distinct construct exists to represent side effects, [[Orthogonal#Computer science|orthogonal]] to the type of functions. A pure function can return a side effect that is subsequently executed, modeling the [[Pure function#Impure functions|impure functions]] of other languages.

Haskell has a [[Strong and weak typing|strong]], [[static type#Static typing|static]] type system based on [[Hindley–Milner type inference]]. Its principal innovation in this area is type classes, originally conceived as a principled way to add [[Polymorphism (computer science)|overloading]] to the language,<ref name="wadler89">{{cite book|last1=Wadler|first1=P.|first2=S. |last2=Blott|title=Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '89 |chapter=How to make ad-hoc polymorphism less ad hoc |year=1989|publisher=[[Association for Computing Machinery|ACM]]|pages=60–76|doi=10.1145/75277.75283|isbn=978-0-89791-294-5|s2cid=15327197|doi-access=free}}</ref> but since finding many more uses.<ref name="hallgren01">{{cite journal|last=Hallgren|first=T.|date=January 2001|title=Fun with Functional Dependencies, or Types as Values in Static Computations in Haskell|journal=Proceedings of the Joint CS/CE Winter Meeting|location=Varberg, Sweden|url=http://www.cs.chalmers.se/~hallgren/Papers/wm01.html}}</ref>

The construct that represents side effects is an example of a [[Monad (functional programming)|monad]]: a general framework which can model various computations such as error handling, [[Nondeterministic algorithm|nondeterminism]], [[parsing]] and [[software transactional memory]]. They are defined as ordinary datatypes, but Haskell provides some [[syntactic sugar]] for their use.

Haskell has an open, published specification,{{sfn|Peyton Jones|2003}} and [[#Implementations|multiple implementations exist]]. Its main implementation, the [[Glasgow Haskell Compiler]] (GHC), is both an [[Interpreter (computing)|interpreter]] and [[Machine code|native-code]] [[compiler]] that runs on most platforms. GHC is noted for its rich type system incorporating recent innovations such as [[generalized algebraic data type]]s and type families. [[The Computer Language Benchmarks Game]] also highlights its high-performance implementation of [[Concurrency (computer science)|concurrency]] and [[Parallel computing|parallelism]].<ref name="shootout">[https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/haskell.html Computer Language Benchmarks Game]</ref>

An active, growing community exists around the language, and more than 5,400 third-party open-source libraries and tools are available in the online package repository ''Hackage''.<ref name="hackage-stats">{{cite web|url=http://hackage.haskell.org/cgi-bin/hackage-scripts/stats|archive-url=https://web.archive.org/web/20130503114836/http://hackage.haskell.org/cgi-bin/hackage-scripts/stats|archive-date=3 May 2013 |title=HackageDB statistics |publisher=Hackage.haskell.org |access-date=26 June 2013}}</ref>

== Code examples ==
{{See also|Haskell features#Examples}}

A [["Hello, World!" program]] in Haskell (only the last line is strictly necessary):

<syntaxhighlight lang="haskell">
module Main (main) where -- not needed in interpreter, is the default in a module file

main :: IO () -- the compiler can infer this type definition
main = putStrLn "Hello, World!"
</syntaxhighlight>

The [[factorial]] function in Haskell, defined in a few different ways (the first line is the [[Type signature|type annotation]], which is optional and is the same for each implementation):
<syntaxhighlight lang="haskell">
factorial :: (Integral a) => a -> a

-- Using recursion (with the "ifthenelse" expression)
factorial n = if n < 2
then 1
else n * factorial (n - 1)

-- Using recursion (with pattern matching)
factorial 0 = 1
factorial n = n * factorial (n - 1)

-- Using recursion (with guards)
factorial n
| n < 2 = 1
| otherwise = n * factorial (n - 1)

-- Using a list and the "product" function
factorial n = product [1..n]

-- Using fold (implements "product")
factorial n = foldl (*) 1 [1..n]

-- Point-free style
factorial = foldr (*) 1 . enumFromTo 1
</syntaxhighlight>

Using Haskell's [[Fixed-point combinator]] allows this function to be written without any explicit recursion.
<syntaxhighlight lang="haskell">
import Data.Function (fix)

factorial = fix fac
where fac f x
| x < 2 = 1
| otherwise = x * f (x - 1)
</syntaxhighlight>


As the ''Integer'' type has [[arbitrary-precision]], this code will compute values such as <code>factorial 100000</code> (a 456,574-digit number), with no loss of precision.

An implementation of an algorithm similar to [[quick sort]] over lists, where the first element is taken as the pivot:
<syntaxhighlight lang="haskell">
-- Type annotation (optional, same for each implementation)
quickSort :: Ord a => [a] -> [a]

-- Using list comprehensions
quickSort [] = [] -- The empty list is already sorted
quickSort (x:xs) = quickSort [a | a <- xs, a < x] -- Sort the left part of the list
++ [x] ++ -- Insert pivot between two sorted parts
quickSort [a | a <- xs, a >= x] -- Sort the right part of the list

-- Using filter
quickSort [] = []
quickSort (x:xs) = quickSort (filter (<x) xs)
++ [x] ++
quickSort (filter (>=x) xs)
</syntaxhighlight>


== Implementations ==
== Implementations ==
The following all comply fully, or very nearly, with the Haskell 98 standard, and are distributed under [[open source]] licences. There are currently no commercial Haskell implementations.
<!-- To anyone wishing to expand or improve this section: the article "A History of Haskell: Being Lazy With Class", linked to in the Further reading section contains detailed descriptions of all implementations. -->
* '''''[[Hugs]]''''' ([http://www.haskell.org/hugs/]) is a [[bytecode]] interpreter. It offers fast compilation of programs and reasonable execution speed. It also comes with a simple graphics library. Hugs is good for people learning the basics of Haskell, but is by no means a "toy" implementation. It is the most portable and lightweight of the Haskell implementations.
* '''''[[Glasgow Haskell Compiler|Glasgow Haskell Compiler]]''''' ([http://www.haskell.org/ghc/]). The Glasgow Haskell Compiler compiles to native code on a number of different architectures, and can also compile to C. GHC is probably the most popular Haskell compiler, and there are quite a few useful libraries (e.g. bindings to [[OpenGL]]) that will only work with GHC.
* '''''nhc98''''' ([http://www.cs.york.ac.uk/fp/nhc98/]) is another bytecode compiler, but the bytecode runs significantly faster than with Hugs. Nhc98 focuses on minimising memory usage, and is a particularly good choice for older, slower machines.
* '''''Gofer''''' An educational version of Haskell, Gopher was developed by Mark Jones. It was supplanted by HUGS.
* '''''HBC''''' ([http://www.cs.chalmers.se/~augustss/hbc/hbc.html]) is another native-code Haskell compiler. It hasn't been actively developed for some time, but is still usable.
*'''''Helium''''' ([http://www.cs.uu.nl/helium/]) is a newer dialect of Haskell. The focus is on making it easy to learn. It currently lacks typeclasses, making it incompatible with many Haskell programs.


All listed implementations are distributed under [[open source license]]s.<ref name="implementations">[http://www.haskell.org/haskellwiki/Implementations "Implementations"] at the Haskell Wiki</ref>
== Extensions ==
*[[O'Haskell]] is an extension of Haskell adding [[object-oriented programming|object-orientation]] and [[concurrent programming]] support.


Implementations that fully or nearly comply with the Haskell 98 standard include:
== External links ==
* The [[Glasgow Haskell Compiler]] (GHC) compiles to native code on many different processor architectures, and to [[ANSI C]], via one of two [[intermediate language]]s: [[C--]], or in more recent versions, [[LLVM]] (formerly Low Level Virtual Machine) bitcode.<ref>{{cite web|
* [http://www.haskell.org The Haskell Home Page]
* [http://www.haskell.org/hawiki/ The Haskell Wiki]
url=https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM|
title=The LLVM Backend|
* [http://www.haskell.org/tutorial/ A Gentle Introduction to Haskell 98] ([http://www.haskell.org/tutorial/haskell-98-tutorial.pdf pdf] format)
website=GHC Trac|
* [http://www.cs.pdx.edu/~apt/cs457_2003/hudak-jones.pdf Haskell vs. Ada vs. C++ vs. Awk vs. ... An Experiment in Software Prototyping Productivity]
date=29 March 2019}}</ref><ref>{{cite conference
* [http://www.willamette.edu/~fruehr/haskell/evolution.html The Evolution of a Haskell Programmer] - a slightly humorous overview of different programming styles available in Haskell
| url = http://www.cse.unsw.edu.au/~chak/papers/TC10.html
* [http://haskell.readscheme.org An Online Bibliography of Haskell Research]
| title = An LLVM Backend for GHC
* [http://www.haskell.org/humor/press.html Haskell Humor]
| last1 = Terei
| first1 = David A.
| last2 = Chakravarty
| first2 = Manuel M. T.
| date = 2010
| publisher = ACM Press
| book-title = Proceedings of ACM SIGPLAN Haskell Symposium 2010}}</ref> GHC has become the ''de facto'' standard Haskell dialect.<ref>C. Ryder and S. Thompson (2005). [http://kar.kent.ac.uk/14237/1/Tech_Chris.pdf "Porting HaRe to the GHC API"]</ref> There are libraries (e.g., bindings to [[OpenGL]]) that work only with GHC. GHC was also distributed with the [[Haskell platform]].
* Jhc, a Haskell compiler written by John Meacham, emphasizes speed and efficiency of generated programs and exploring new program transformations.
** Ajhc is a fork of Jhc.
* The Utrecht Haskell Compiler (UHC) is a Haskell implementation from [[Utrecht University]].<ref>[http://www.cs.uu.nl/wiki/UHC Utrecht Haskell Compiler]</ref> It supports almost all Haskell 98 features plus many experimental extensions. It is implemented using [[attribute grammar]]s and is primarily used for research on generated type systems and language extensions.


Implementations no longer actively maintained include:
* The Haskell User's Gofer System ([[Hugs (interpreter)|Hugs]]) is a [[bytecode]] interpreter. It was once one of the implementations used most widely, alongside the GHC compiler,{{sfn|Hudak|Hughes|Peyton Jones|Wadler|2007|pp=12–22}} but has now been mostly replaced by GHCi. It also comes with a graphics library.
* HBC is an early implementation supporting Haskell 1.4. It was implemented by [[Lennart Augustsson]] in, and based on, [[Lazy ML]]. It has not been actively developed for some time.
* nhc98 is a bytecode compiler focusing on minimizing memory use.
** The York Haskell Compiler ([[Yhc]]) was a fork of nhc98, with the goals of being simpler, more portable and efficient, and integrating support for Hat, the Haskell tracer. It also had a [[JavaScript]] backend, allowing users to run Haskell programs in [[web browser]]s.


Implementations not fully Haskell 98 compliant, and using a variant Haskell language, include:
{{Major programming languages small}}
* Eta and Frege are dialects of Haskell targeting the [[Java virtual machine]].
* [[Gofer (software)|Gofer]] is an educational dialect of Haskell, with a feature called ''constructor classes'', developed by Mark Jones. It is supplanted by Haskell User's Gofer System (Hugs).
* Helium, a newer dialect of Haskell. The focus is on making learning easier via clearer error messages by disabling type classes as a default.


== Notable applications ==
[[Category:Haskell dialects|*]]
[[Category:Programming languages]]
[[Category:Functional languages]]
[[Category:Declarative programming languages]]


* [[Agda (programming language)|Agda]] is a proof assistant written in Haskell.<ref>{{Citation|title=Agda 2|date=2021-10-15|url=https://github.com/agda/agda|publisher=Agda Github Community|access-date=2021-10-16}}</ref>
[[cs:Haskell]]
*[[Cabal (software)|Cabal]] is a tool for [[Build automation|building]] and packaging Haskell libraries and programs.<ref>{{cite web|url=https://www.haskell.org/cabal/|title=The Haskell Cabal|access-date=8 April 2015}}</ref>
[[de:Haskell (Programmiersprache)]]
* [[Darcs]] is a [[revision control system]] written in Haskell, with several innovative features, such as more precise control of patches to apply.
[[eo:Haskell]]
* [[Glasgow Haskell Compiler]] (GHC) is also often a testbed for advanced functional programming features and optimizations in other programming languages.
[[fr:Haskell]]
* [[Git-annex]] is a tool to manage (big) data files under [[Git]] version control. It also provides a distributed file synchronization system (git-annex assistant).
[[it:Haskell]]
* [[Linspire]] Linux chose Haskell for system tools development.<ref>{{cite web|url=http://urchin.earth.li/pipermail/debian-haskell/2006-May/000169.html|title=Linspire/Freespire Core OS Team and Haskell|work=Debian Haskell mailing list|date=May 2006|access-date=14 June 2006|archive-date=27 December 2017|archive-url=https://web.archive.org/web/20171227234048/http://urchin.earth.li/pipermail/debian-haskell/2006-May/000169.html|url-status=dead}}</ref>
[[nl:Haskell]]
* [[Pandoc]] is a tool to convert one markup format into another.
[[ja:Haskell]]
* [[Pugs (compiler)|Pugs]] is a [[compiler]] and [[Interpreter (computing)|interpreter]] for the [[programming language]] then named [[Perl]] 6, but since renamed [[Raku (programming language)|Raku]].
[[pl:Haskell]]
*[[TidalCycles]] is a domain special language for live coding musical patterns, embedded in Haskell.<ref>{{cite web|title=Live code with Tidal Cycles|url=https://doc.tidalcycles.org/|access-date=2022-01-19|website=Tidal Cycles|language=en}}</ref>
[[pt:Haskell (linguagem de programação)]]
*[[Xmonad]] is a [[window manager]] for the [[X Window System]], written fully in Haskell.<ref>xmonad.org</ref>
[[ru:Haskell]]
*GarganText<ref>{{cite web |url=https://gitlab.iscpif.fr/gargantext/main |title=Gargantext – Main |date=13 July 2023}}</ref> is a collaborative tool to map through semantic analysis texts on any [[web browser]], written fully in Haskell and [[PureScript]], which is used for instance in the research community to draw up state-of-the-art reports and roadmaps.<ref>{{cite thesis |url=https://hal-lara.archives-ouvertes.fr/hal-04091733/ |title=Toward a Research Agenda on Digital Media and Humanity Well-Being |date=8 May 2023 |type=report |last1=David |first1=Chavalarias |last2=Gelder |first2=Beatrice De |last3=Caldarelli |first3=Guido |last4=Rosnay |first4=Melanie Dulong de |last5=Casilli |first5=Antonio A. |last6=Delanoë |first6=Alexandre |last7=Fassi |first7=Luisa |last8=Frau-Meigs |first8=Divina |last9=Jouve |first9=Bertrand |last10=Nowak |first10=Andrzej |last11=Rodríguez-Doncel |first11=Víctor |last12=Roth |first12=Camille |last13=Slater |first13=Mel |last14=Amor |first14=Nahla Ben |last15=Boros |first15=Anna |last16=Brunori |first16=Michela |last17=Brites |first17=Maria Jose |last18=Dana |first18=Diminescu |last19=Datchary |first19=Caroline |last20=Fabrizio |first20=Silvestri |last21=Hernandez |first21=Laura |last22=Horodecki |first22=Pawel |last23=Kotilainen |first23=Sirkku |last24=Lassègue |first24=Jean |last25=Lazega |first25=Emmanuel |last26=Lobbé |first26=Quentin |last27=Lukowicz |first27=Paul |last28=McDougall |first28=Julian |last29=Meacham |first29=Darian |last30=Omodei |first30=Elisa |display-authors=1}}</ref>
[[sk:Haskell (programovací jazyk)]]

[[zh:Haskell]]
=== Industry ===

*[[Bluespec]] [[SystemVerilog]] (BSV) is a language extension of Haskell, for designing [[electronics]]. It is an example of a [[domain-specific language]] embedded into Haskell. Further, Bluespec, Inc.'s tools are implemented in Haskell.
* [[Cryptol]], a language and toolchain for developing and verifying [[cryptography]] algorithms, is implemented in Haskell.
* [[Facebook]] implements its anti-spam programs<ref>{{cite web|url=https://code.fb.com/security/fighting-spam-with-haskell/|title=Fighting spam with Haskell|date=26 June 2015|website=Facebook Code|language=en-US|access-date=11 August 2019}}</ref> in Haskell, maintaining the underlying data access library as [[open-source software]].<ref>{{cite web|url=https://code.fb.com/web/open-sourcing-haxl-a-library-for-haskell/|title=Open-sourcing Haxl, a library for Haskell|date=10 June 2014|website=Facebook Code|language=en-US|access-date=11 August 2019}}</ref>
*The [[Cardano (blockchain platform)|Cardano blockchain platform]] is implemented in Haskell.<ref>{{cite web|url=https://github.com/input-output-hk/cardano-node |title=input-output-hk/cardano-node: The core component that is used to participate in a Cardano decentralised blockchain |publisher=GitHub |date= |accessdate=2022-03-18}}</ref>
*[[GitHub]] implemented [[Semantic (software)|Semantic]], an open-source library for analysis, diffing, and interpretation of untrusted source code, in Haskell.<ref>{{Citation|title=Parsing, analyzing, and comparing source code across many languages: github/semantic|date=7 June 2019|url=https://github.com/github/semantic|publisher=GitHub|access-date=7 June 2019}}</ref>
*[[Standard Chartered]]'s financial modelling language Mu is syntactic Haskell running on a strict runtime.<ref>{{cite web|url=https://anil.recoil.org/papers/2011-cufp-scribe-preprint.pdf |title=Commercial Users of Functional Programming Workshop Report|access-date=10 June 2022}}</ref>
* [[seL4]], the first [[Formal methods|formally verified]] [[microkernel]],<ref name="klein-sosp09">
A formal proof of functional correctness was completed in 2009.
{{ cite conference
|first1=Gerwin
|last1=Klein
|first2=Kevin
|last2=Elphinstone
|first3=Gernot
|last3=Heiser
|author3-link=Gernot Heiser
|first4=June
|last4=Andronick
|first5=David
|last5=Cock
|first6=Philip
|last6=Derrin
|first7=Dhammika
|last7=Elkaduwe
|first8=Kai
|last8=Engelhardt
|first9=Rafal
|last9=Kolanski
|first10=Michael
|last10=Norrish
|first11=Thomas
|last11=Sewell
|first12=Harvey
|last12=Tuch
|first13=Simon
|last13=Winwood
|title=seL4: Formal verification of an OS kernel
|book-title=22nd ACM Symposium on Operating System Principles
|date=October 2009
|location=Big Sky, Montana, USA
|url=http://www.sigops.org/sosp/sosp09/papers/klein-sosp09.pdf
}}
</ref> used Haskell as a prototyping language for the OS developer.<ref name="klein-sosp09"/>{{rp|p.2}} At the same time, the Haskell code defined an executable specification with which to reason, for automatic translation by the theorem-proving tool.<ref name="klein-sosp09"/>{{rp|p.3}} The Haskell code thus served as an intermediate prototype before final [[C (programming language)|C]] refinement.<ref name="klein-sosp09"/>{{rp|p.3}}
*[[Target Corporation|Target]] stores' supply chain optimization software is written in Haskell.<ref>{{cite web |url=https://www.youtube.com/watch?v=0EgHNq6Pej8 |title=Tikhon Jelvis: Haskell at Target |website=[[YouTube]]|date=22 April 2017 }}</ref>
*[[Co–Star]]<ref>{{cite web |title=Why Co–Star uses Haskell |url=https://www.costarastrology.com/why-haskell/ |website=[[Co–Star]] |access-date=30 September 2023}}</ref>
*[[Mercury (company)|Mercury]]'s back end is written in Haskell.<ref>{{Cite web |title=Haskell in Production: Mercury |url=https://serokell.io/blog/haskell-in-production-mercury |access-date=2024-10-11 |website=Serokell|language=en}}</ref>

=== Web ===

Notable [[web framework]]s written for Haskell include:<ref>{{cite web|url=https://wiki.haskell.org/Web/Frameworks|title=Web/Frameworks – HaskellWiki|website=wiki.haskell.org|access-date=17 September 2022}}</ref>

* IHP
* [[Servant (web framework)|Servant]]
* [[Snap (web framework)|Snap]]
* [[Yesod (web framework)|Yesod]]

==Criticism==

Jan-Willem Maessen, in 2002, and [[Simon Peyton Jones]], in 2003, discussed problems associated with lazy evaluation while also acknowledging the theoretical motives for it.<ref>Jan-Willem Maessen. ''Eager Haskell: Resource-bounded execution yields efficient iteration''. Proceedings of the 2002 [[Association for Computing Machinery]] (ACM) SIGPLAN workshop on Haskell.</ref><ref>{{dead link|date=May 2022}}Simon Peyton Jones. [http://research.microsoft.com/~simonpj/papers/haskell-retrospective ''Wearing the hair shirt: a retrospective on Haskell'']. Invited talk at [[POPL]] 2003.</ref> In addition to purely practical considerations such as improved performance,<ref>{{cite web|url=http://www.haskell.org/pipermail/haskell/2006-June/018127.html|title=Lazy evaluation can lead to excellent performance, such as in The Computer Language Benchmarks Game|date=27 June 2006 }}</ref> they note that lazy evaluation makes it more difficult for programmers to reason about the performance of their code (particularly its space use).

Bastiaan Heeren, Daan Leijen, and Arjan van IJzendoorn in 2003 also observed some stumbling blocks for Haskell learners: "The subtle syntax and sophisticated type system of Haskell are a double edged sword—highly appreciated by experienced programmers but also a source of frustration among beginners, since the generality of Haskell often leads to cryptic error messages."<ref>{{cite book|first1=Bastiaan |last1=Heeren |first2=Daan |last2=Leijen |first3=Arjan |last3=van IJzendoorn|title=Proceedings of the 2003 ACM SIGPLAN workshop on Haskell |chapter=Helium, for learning Haskell |year=2003|pages=62–71 |doi=10.1145/871895.871902 |isbn=1581137583 |s2cid=11986908 |chapter-url=http://www.cs.uu.nl/~bastiaan/heeren-helium.pdf}}</ref> To address the error messages researchers from Utrecht University developed an advanced interpreter called [[Helium (Haskell)|Helium]], which improved the user-friendliness of error messages by limiting the generality of some Haskell features. In particular it disables type classes by default.<ref>{{cite web|url=https://github.com/Helium4Haskell/helium/blob/master/COMPILERDOCS.md |title=Helium Compiler Docs |publisher=GitHub |access-date=9 June 2023}}</ref>

Ben Lippmeier designed Disciple<ref>{{cite web|url=http://www.haskell.org/haskellwiki/DDC |title=DDC – HaskellWiki |publisher=Haskell.org |date=3 December 2010 |access-date=26 June 2013}}</ref> as a [[evaluation strategy|strict-by-default]] (lazy by explicit annotation) dialect of Haskell with a type-and-effect system, to address Haskell's difficulties in reasoning about lazy evaluation and in using traditional data structures such as mutable arrays.<ref>Ben Lippmeier, [http://www.cse.unsw.edu.au/~benl/papers/thesis/lippmeier-impure-world.pdf Type Inference and Optimisation for an Impure World], [[Australian National University]] (2010) PhD thesis, chapter 1</ref> He argues (p.&nbsp;20) that "destructive update furnishes the programmer with two important and powerful tools&nbsp;... a set of efficient array-like data structures for managing collections of objects, and ... the ability to broadcast a new value to all parts of a program with minimal burden on the programmer."

[[Robert Harper (computer scientist)|Robert Harper]], one of the authors of Standard ML, has given his reasons for not using Haskell to teach introductory programming. Among these are the difficulty of reasoning about resource use with non-strict evaluation, that lazy evaluation complicates the definition of datatypes and inductive reasoning,<ref>{{cite web|url=http://existentialtype.wordpress.com/2011/04/24/the-real-point-of-laziness/|title=The point of laziness|author=Robert Harper|date=25 April 2011 }} {{Closed access}}
</ref> and the "inferiority" of Haskell's (old) class system compared to ML's module system.<ref>{{cite web|url=http://existentialtype.wordpress.com/2011/04/16/modules-matter-most/|author=Robert Harper|title=Modules matter most.|date=16 April 2011 }} {{Closed access}}
</ref>

Haskell's build tool, [[Cabal (software)|Cabal]], has historically been criticized for poorly handling multiple versions of the same library, a problem known as "Cabal hell". The Stackage server and [[Stack (Haskell)|Stack]] build tool were made in response to these criticisms.<ref>{{cite web|url=https://www.yesodweb.com/blog/2012/11/solving-cabal-hell|title=Solving Cabal Hell|website=www.yesodweb.com|access-date=11 August 2019}}</ref> Cabal itself now has a much more sophisticated build system, heavily inspired by [[Nix package manager|Nix]],<ref>{{cite web|url=http://blog.ezyang.com/2016/05/announcing-cabal-new-build-nix-style-local-builds/|title=Announcing cabal new-build: Nix-style local builds|access-date=1 October 2019}}</ref> which became the default with version 3.0.

== Related languages ==

[[Clean (programming language)|Clean]] is a close, slightly older relative of Haskell. Its biggest deviation from Haskell is in the use of [[uniqueness type]]s instead of monads for [[input/output]] (I/O) and side effects.

A series of languages inspired by Haskell, but with different type systems, have been developed, including:
* [[Agda (programming language)|Agda]], a functional language with [[dependent type]]s.
* [[Cayenne (programming language)|Cayenne]], with dependent types.
* [[Elm (programming language)|Elm]], a functional language to create web front-end apps, no support for user-defined or higher-[[kind (type theory)|kinded]] [[type classes]] or instances.
* [[Epigram (programming language)|Epigram]], a functional language with dependent types suitable for proving properties of programs.
* [[Idris (programming language)|Idris]], a general purpose functional language with dependent types, developed at the [[University of St Andrews]].
* [[PureScript]] transpiles to JavaScript.
* [[Ωmega]], a strict language that allows introduction of new [[Kind (type theory)|kind]]s, and programming at the type level.

Other related languages include:
* [[Curry (programming language)|Curry]], a functional/logic programming language based on Haskell.

Notable Haskell variants include:
*[[generic programming#Generic Haskell|Generic Haskell]], a version of Haskell with type system support for [[generic programming]].
*[[Hume (programming language)|Hume]], a strict functional language for [[embedded system]]s based on processes as stateless automata over a sort of tuples of one element mailbox channels where the state is kept by feedback into the mailboxes, and a mapping description from outputs to channels as box wiring, with a Haskell-like expression language and syntax.

==Conferences and workshops==
The Haskell community meets regularly for research and development activities. The main events are:
* [[International Conference on Functional Programming]] (ICFP)
* [[Haskell Symposium]] (formerly the Haskell Workshop)
* Haskell Implementors Workshop
* [[Commercial Users of Functional Programming]] (CUFP)
* ZuriHac,<ref>https://zfoh.ch/ {{Bare URL inline|date=August 2024}}</ref> kind of [[Hackathon]] held every year in [[Zurich]]

Starting in 2006, a series of organized ''hackathons'' has occurred, the Hac series, aimed at improving the programming language tools and libraries.<ref>{{cite web |title=Hackathon – HaskellWiki |url=http://haskell.org/haskellwiki/Hackathon}}</ref>

== References ==
{{Reflist|30em}}

==Bibliography==
; Reports
* {{cite book |editor-last=Peyton Jones |editor-first=Simon |editor-link=Simon Peyton Jones |title=Haskell 98 Language and Libraries: The Revised Report |url=http://haskell.org/onlinereport/ |year=2003 |publisher=Cambridge University Press |isbn=978-0521826143}}
* {{cite book |editor-last=Marlow |editor-first=Simon |year=2010 |editor-link=Simon Marlow |title=Haskell 2010 Language Report |url=https://www.haskell.org/definition/haskell2010.pdf |publisher=Haskell.org}}
; Textbooks
*{{cite book |last=Davie |first=Antony |title=An Introduction to Functional Programming Systems Using Haskell |publisher=Cambridge University Press |year=1992 |isbn=978-0-521-25830-2}}
*{{cite book |last=Bird |first=Richard |author-link=Richard Bird (computer scientist) |year=1998 |url=http://www.cs.ox.ac.uk/publications/books/functional/ |title=Introduction to Functional Programming using Haskell |edition=2nd |publisher=Prentice Hall Press |isbn=978-0-13-484346-9}}
*{{cite book |last=Hudak |first=Paul |author-link=Paul Hudak |title=The Haskell School of Expression: Learning Functional Programming through Multimedia |publisher=Cambridge University Press |location=New York |year=2000 |isbn=978-0521643382 |url=http://www.cs.yale.edu/homes/hudak/SOE/}}
*{{cite book |last=Hutton |first=Graham |year=2007 |title=Programming in Haskell |publisher=Cambridge University Press |isbn=978-0521692694 |url=http://www.cs.nott.ac.uk/~gmh/book.html}}
*{{Cite book |last1=O'Sullivan |first1=Bryan |last2=Stewart |first2=Don |last3=Goerzen |first3=John |year=2008 |title=Real World Haskell |publisher=O'Reilly |location=Sebastopol |isbn=978-0-596-51498-3}} [http://book.realworldhaskell.org/read/ Real World Haskell] (full text).
*{{cite book |last=Thompson |first=Simon |title=Haskell: The Craft of Functional Programming |edition=3rd |publisher=Addison-Wesley |year=2011 |isbn=978-0201882957 |url=http://www.haskellcraft.com/}}
*{{cite book |last=Lipovača |first=Miran |title=Learn You a Haskell for Great Good! |url=https://archive.org/details/learnyouhaskellf00lipo_0 |date=April 2011 |publisher=No Starch Press |location=San Francisco |isbn=978-1-59327-283-8 |url-access=registration}} ([http://learnyouahaskell.com/chapters full text])
*{{cite book |last=Bird |first=Richard |author-link=Richard Bird (computer scientist) |year=2014 |title=Thinking Functionally with Haskell |publisher=Cambridge University Press |isbn= 978-1-107-45264-0}}
*{{cite book |last1=Bird |first1=Richard |author1-link=Richard Bird (computer scientist) |last2=Gibbons |first2=Jeremy |author2-link=Jeremy Gibbons |date=July 2020 |title=Algorithm Design with Haskell |publisher=Cambridge University Press |isbn=978-1-108-49161-7}}
; Tutorials
*{{cite web |last1=Hudak |first1=Paul |author-link=Paul Hudak |last2=Peterson |first2=John |last3=Fasel |first3=Joseph |date=June 2000 |url=http://haskell.org/tutorial/ |title=A Gentle Introduction To Haskell, Version 98 |work=Haskell.org}}
*Learn You a Haskell for Great Good! - A community version (''[https://learnyouahaskell.github.io learnyouahaskell.github.io])''. An up-to-date community maintained version of the renowned "Learn You a Haskell" (LYAH) guide.
*{{Cite journal |first=Hal III |last=Daumé |url=http://hal3.name/docs/daume02yaht.pdf |title=Yet Another Haskell Tutorial}} Assumes far less prior knowledge than official tutorial.
*{{Cite journal |last=Yorgey |first=Brent |date=12 March 2009 |title=The Typeclassopedia |journal=The Monad.Reader |issue=13 |pages=17–68 |url=http://www.haskell.org/wikiupload/8/85/TMR-Issue13.pdf}}
*{{cite book |last=Maguire |first=Sandy |year=2018 |title=Thinking with Types: Type-Level Programming in Haskell |url=https://thinkingwithtypes.com/}}
; History
* {{cite book |last1=Hudak |first1=Paul |author-link1=Paul Hudak |last2=Hughes |first2=John |author-link2=John Hughes (computer scientist) |last3=Peyton Jones |first3=Simon |author-link3=Simon Peyton Jones |last4=Wadler |first4=Philip |title=Proceedings of the third ACM SIGPLAN conference on History of programming languages |chapter=A history of Haskell |author-link4=Philip Wadler |chapter-url=http://research.microsoft.com/~simonpj/papers/history-of-haskell/history.pdf |doi=10.1145/1238844.1238856 |year=2007 |pages=12–1–55 |isbn=978-1-59593-766-7 |s2cid=52847907}}
* {{cite journal |last=Hamilton |first=Naomi |date=19 September 2008 |title=The A-Z of Programming Languages: Haskell |journal=[[Computerworld]] |url=http://www.computerworld.com.au/article/261007/a-z_programming_languages_haskell/}}

==External links==
{{Wikibooks|Haskell}}
{{Wikibooks|Write Yourself a Scheme in 48 Hours}}
*{{Official website}}

{{Portal bar|Computer programming}}
{{Haskell programming}}
{{Haskell Curry}}
{{Programming languages}}
{{Authority control}}

[[Category:Academic programming languages]]
[[Category:Educational programming languages]]
[[Category:Functional languages]]
[[Category:Haskell programming language family| ]]
[[Category:Literate programming]]
[[Category:Pattern matching programming languages]]
[[Category:Programming languages created in 1990]]
[[Category:Statically typed programming languages]]
<!-- Hidden categories below -->
[[Category:Articles with example Haskell code]]

Latest revision as of 04:06, 11 October 2024

Haskell
Logo of Haskell
ParadigmPurely functional
Designed byLennart Augustsson, Dave Barton, Brian Boutel, Warren Burton, Joseph Fasel, Kevin Hammond, Ralf Hinze, Paul Hudak, John Hughes, Thomas Johnsson, Mark Jones, Simon Peyton Jones, John Launchbury, Erik Meijer, John Peterson, Alastair Reid, Colin Runciman, Philip Wadler
First appeared1990; 34 years ago (1990)[1]
Stable release
Haskell 2010[2] / July 2010; 14 years ago (2010-07)
Preview release
Haskell 2020 announced[3]
Typing disciplineInferred, static, strong
OSCross-platform
Filename extensions.hs, .lhs
Websitehaskell.org
Major implementations
GHC, Hugs, NHC, JHC, Yhc, UHC
Dialects
Gofer
Influenced by
Clean,[4] FP,[4] Gofer,[4] Hope and Hope+,[4] Id,[4] ISWIM,[4] KRC,[4] Lisp,[4]
Miranda,[4] ML and Standard ML,[4] Orwell, SASL,[4] Scheme,[4] SISAL[4]
Influenced
Agda,[5] Bluespec,[6] C++11/Concepts,[7]
C#/LINQ,[8][9][10][11] CAL,[citation needed] Cayenne,[8] Clean,[8] Clojure,[12]
CoffeeScript,[13] Curry,[8] Elm,
Epigram,[citation needed] Escher,[14] F#,[15] Hack,[16] Idris,[17]
Isabelle,[8] Java/Generics,[8] LiveScript,[18]
Mercury,[8] Ωmega, PureScript,[19] Python,[8][20] Raku,[21]
Rust,[22] Scala,[8][23] Swift,[24]
Visual Basic 9.0[8][9]

Haskell (/ˈhæskəl/[25]) is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation.[26][27] Designed for teaching, research, and industrial applications, Haskell has pioneered several programming language features such as type classes, which enable type-safe operator overloading, and monadic input/output (IO). It is named after logician Haskell Curry.[1] Haskell's main implementation is the Glasgow Haskell Compiler (GHC).

Haskell's semantics are historically based on those of the Miranda programming language, which served to focus the efforts of the initial Haskell working group.[28] The last formal specification of the language was made in July 2010, while the development of GHC continues to expand Haskell via language extensions.

Haskell is used in academia and industry.[29][30][31] As of May 2021, Haskell was the 28th most popular programming language by Google searches for tutorials,[32] and made up less than 1% of active users on the GitHub source code repository.[33]

History

[edit]

After the release of Miranda by Research Software Ltd. in 1985, interest in lazy functional languages grew. By 1987, more than a dozen non-strict, purely functional programming languages existed. Miranda was the most widely used, but it was proprietary software. At the conference on Functional Programming Languages and Computer Architecture (FPCA '87) in Portland, Oregon, there was a strong consensus that a committee be formed to define an open standard for such languages. The committee's purpose was to consolidate existing functional languages into a common one to serve as a basis for future research in functional-language design.[34]

Haskell 1.0 to 1.4

[edit]

Haskell was developed by a committee, attempting to bring together off the shelf solutions where possible.

Type classes, which enable type-safe operator overloading, were first proposed by Philip Wadler and Stephen Blott to address the ad-hoc handling of equality types and arithmetic overloading in languages at the time.[35]

In early versions of Haskell up until and including version 1.2, user interaction and input/output (IO) were handled by both streams based and continuation based mechanisms which were widely considered unsatisfactory.[36] In version 1.3, monadic IO was introduced, along with the generalisation of type classes to higher kinds (type constructors). Along with "do notation", which provides syntactic sugar for the Monad type class, this gave Haskell an effect system that maintained referential transparency and was convenient.

Other notable changes in early versions were the approach to the 'seq' function, which creates a data dependency between values, and is used in lazy languages to avoid excessive memory consumption; with it moving from a type class to a standard function to make refactoring more practical.

The first version of Haskell ("Haskell 1.0") was defined in 1990.[1] The committee's efforts resulted in a series of language definitions (1.0, 1.1, 1.2, 1.3, 1.4).

Hierarchy of type classes in the Haskell prelude as of GHC 7.10. The inclusion of Foldable and Traversable (with corresponding changes to the type signatures of some functions), and of Applicative as intermediate between Functor and Monad, are deviations from the Haskell 2010 standard.

Haskell 98

[edit]

In late 1997, the series culminated in Haskell 98, intended to specify a stable, minimal, portable version of the language and an accompanying standard library for teaching, and as a base for future extensions. The committee expressly welcomed creating extensions and variants of Haskell 98 via adding and incorporating experimental features.[34]

In February 1999, the Haskell 98 language standard was originally published as The Haskell 98 Report.[34] In January 2003, a revised version was published as Haskell 98 Language and Libraries: The Revised Report.[27] The language continues to evolve rapidly, with the Glasgow Haskell Compiler (GHC) implementation representing the current de facto standard.[37]

Haskell 2010

[edit]

In early 2006, the process of defining a successor to the Haskell 98 standard, informally named Haskell Prime, began.[38] This was intended to be an ongoing incremental process to revise the language definition, producing a new revision up to once per year. The first revision, named Haskell 2010, was announced in November 2009[2] and published in July 2010.

Haskell 2010 is an incremental update to the language, mostly incorporating several well-used and uncontroversial features previously enabled via compiler-specific flags.

  • Hierarchical module names. Module names are allowed to consist of dot-separated sequences of capitalized identifiers, rather than only one such identifier. This lets modules be named in a hierarchical manner (e.g., Data.List instead of List), although technically modules are still in a single monolithic namespace. This extension was specified in an addendum to Haskell 98 and was in practice universally used.
  • The foreign function interface (FFI) allows bindings to other programming languages. Only bindings to C are specified in the Report, but the design allows for other language bindings. To support this, data type declarations were permitted to contain no constructors, enabling robust nonce types for foreign data that could not be constructed in Haskell. This extension was also previously specified in an Addendum to the Haskell 98 Report and widely used.
  • So-called n+k patterns (definitions of the form fact (n+1) = (n+1) * fact n) were no longer allowed. This syntactic sugar had misleading semantics, in which the code looked like it used the (+) operator, but in fact desugared to code using (-) and (>=).
  • The rules of type inference were relaxed to allow more programs to type check.
  • Some syntax issues (changes in the formal grammar) were fixed: pattern guards were added, allowing pattern matching within guards; resolution of operator fixity was specified in a simpler way that reflected actual practice; an edge case in the interaction of the language's lexical syntax of operators and comments was addressed, and the interaction of do-notation and if-then-else was tweaked to eliminate unexpected syntax errors.
  • The LANGUAGE pragma was specified. By 2010, dozens of extensions to the language were in wide use, and GHC (among other compilers) provided the LANGUAGE pragma to specify individual extensions with a list of identifiers. Haskell 2010 compilers are required to support the Haskell2010 extension and are encouraged to support several others, which correspond to extensions added in Haskell 2010.

Future standards

[edit]

The next formal specification had been planned for 2020.[3] On 29 October 2021, with GHC version 9.2.1, the GHC2021 extension was released. While this is not a formal language spec, it combines several stable, widely-used GHC extensions to Haskell 2010.[39][40]

Features

[edit]

Haskell features lazy evaluation, lambda expressions, pattern matching, list comprehension, type classes and type polymorphism. It is a purely functional programming language, which means that functions generally have no side effects. A distinct construct exists to represent side effects, orthogonal to the type of functions. A pure function can return a side effect that is subsequently executed, modeling the impure functions of other languages.

Haskell has a strong, static type system based on Hindley–Milner type inference. Its principal innovation in this area is type classes, originally conceived as a principled way to add overloading to the language,[41] but since finding many more uses.[42]

The construct that represents side effects is an example of a monad: a general framework which can model various computations such as error handling, nondeterminism, parsing and software transactional memory. They are defined as ordinary datatypes, but Haskell provides some syntactic sugar for their use.

Haskell has an open, published specification,[27] and multiple implementations exist. Its main implementation, the Glasgow Haskell Compiler (GHC), is both an interpreter and native-code compiler that runs on most platforms. GHC is noted for its rich type system incorporating recent innovations such as generalized algebraic data types and type families. The Computer Language Benchmarks Game also highlights its high-performance implementation of concurrency and parallelism.[43]

An active, growing community exists around the language, and more than 5,400 third-party open-source libraries and tools are available in the online package repository Hackage.[44]

Code examples

[edit]

A "Hello, World!" program in Haskell (only the last line is strictly necessary):

module Main (main) where          -- not needed in interpreter, is the default in a module file

main :: IO ()                     -- the compiler can infer this type definition
main = putStrLn "Hello, World!"

The factorial function in Haskell, defined in a few different ways (the first line is the type annotation, which is optional and is the same for each implementation):

factorial :: (Integral a) => a -> a

-- Using recursion (with the "ifthenelse" expression)
factorial n = if n < 2
              then 1
              else n * factorial (n - 1)

-- Using recursion (with pattern matching)
factorial 0 = 1
factorial n = n * factorial (n - 1)

-- Using recursion (with guards)
factorial n
   | n < 2     = 1
   | otherwise = n * factorial (n - 1)

-- Using a list and the "product" function
factorial n = product [1..n]

-- Using fold (implements "product")
factorial n = foldl (*) 1 [1..n]

-- Point-free style
factorial = foldr (*) 1 . enumFromTo 1

Using Haskell's Fixed-point combinator allows this function to be written without any explicit recursion.

import Data.Function (fix)

factorial = fix fac
  where fac f x 
          | x < 2     = 1
          | otherwise = x * f (x - 1)


As the Integer type has arbitrary-precision, this code will compute values such as factorial 100000 (a 456,574-digit number), with no loss of precision.

An implementation of an algorithm similar to quick sort over lists, where the first element is taken as the pivot:

-- Type annotation (optional, same for each implementation)
quickSort :: Ord a => [a] -> [a]

-- Using list comprehensions
quickSort []     = []                               -- The empty list is already sorted
quickSort (x:xs) = quickSort [a | a <- xs, a < x]   -- Sort the left part of the list
                   ++ [x] ++                        -- Insert pivot between two sorted parts
                   quickSort [a | a <- xs, a >= x]  -- Sort the right part of the list

-- Using filter
quickSort []     = []
quickSort (x:xs) = quickSort (filter (<x) xs)
                   ++ [x] ++
                   quickSort (filter (>=x) xs)

Implementations

[edit]

All listed implementations are distributed under open source licenses.[45]

Implementations that fully or nearly comply with the Haskell 98 standard include:

  • The Glasgow Haskell Compiler (GHC) compiles to native code on many different processor architectures, and to ANSI C, via one of two intermediate languages: C--, or in more recent versions, LLVM (formerly Low Level Virtual Machine) bitcode.[46][47] GHC has become the de facto standard Haskell dialect.[48] There are libraries (e.g., bindings to OpenGL) that work only with GHC. GHC was also distributed with the Haskell platform.
  • Jhc, a Haskell compiler written by John Meacham, emphasizes speed and efficiency of generated programs and exploring new program transformations.
    • Ajhc is a fork of Jhc.
  • The Utrecht Haskell Compiler (UHC) is a Haskell implementation from Utrecht University.[49] It supports almost all Haskell 98 features plus many experimental extensions. It is implemented using attribute grammars and is primarily used for research on generated type systems and language extensions.

Implementations no longer actively maintained include:

  • The Haskell User's Gofer System (Hugs) is a bytecode interpreter. It was once one of the implementations used most widely, alongside the GHC compiler,[50] but has now been mostly replaced by GHCi. It also comes with a graphics library.
  • HBC is an early implementation supporting Haskell 1.4. It was implemented by Lennart Augustsson in, and based on, Lazy ML. It has not been actively developed for some time.
  • nhc98 is a bytecode compiler focusing on minimizing memory use.
    • The York Haskell Compiler (Yhc) was a fork of nhc98, with the goals of being simpler, more portable and efficient, and integrating support for Hat, the Haskell tracer. It also had a JavaScript backend, allowing users to run Haskell programs in web browsers.

Implementations not fully Haskell 98 compliant, and using a variant Haskell language, include:

  • Eta and Frege are dialects of Haskell targeting the Java virtual machine.
  • Gofer is an educational dialect of Haskell, with a feature called constructor classes, developed by Mark Jones. It is supplanted by Haskell User's Gofer System (Hugs).
  • Helium, a newer dialect of Haskell. The focus is on making learning easier via clearer error messages by disabling type classes as a default.

Notable applications

[edit]
  • Agda is a proof assistant written in Haskell.[51]
  • Cabal is a tool for building and packaging Haskell libraries and programs.[52]
  • Darcs is a revision control system written in Haskell, with several innovative features, such as more precise control of patches to apply.
  • Glasgow Haskell Compiler (GHC) is also often a testbed for advanced functional programming features and optimizations in other programming languages.
  • Git-annex is a tool to manage (big) data files under Git version control. It also provides a distributed file synchronization system (git-annex assistant).
  • Linspire Linux chose Haskell for system tools development.[53]
  • Pandoc is a tool to convert one markup format into another.
  • Pugs is a compiler and interpreter for the programming language then named Perl 6, but since renamed Raku.
  • TidalCycles is a domain special language for live coding musical patterns, embedded in Haskell.[54]
  • Xmonad is a window manager for the X Window System, written fully in Haskell.[55]
  • GarganText[56] is a collaborative tool to map through semantic analysis texts on any web browser, written fully in Haskell and PureScript, which is used for instance in the research community to draw up state-of-the-art reports and roadmaps.[57]

Industry

[edit]

Web

[edit]

Notable web frameworks written for Haskell include:[67]

Criticism

[edit]

Jan-Willem Maessen, in 2002, and Simon Peyton Jones, in 2003, discussed problems associated with lazy evaluation while also acknowledging the theoretical motives for it.[68][69] In addition to purely practical considerations such as improved performance,[70] they note that lazy evaluation makes it more difficult for programmers to reason about the performance of their code (particularly its space use).

Bastiaan Heeren, Daan Leijen, and Arjan van IJzendoorn in 2003 also observed some stumbling blocks for Haskell learners: "The subtle syntax and sophisticated type system of Haskell are a double edged sword—highly appreciated by experienced programmers but also a source of frustration among beginners, since the generality of Haskell often leads to cryptic error messages."[71] To address the error messages researchers from Utrecht University developed an advanced interpreter called Helium, which improved the user-friendliness of error messages by limiting the generality of some Haskell features. In particular it disables type classes by default.[72]

Ben Lippmeier designed Disciple[73] as a strict-by-default (lazy by explicit annotation) dialect of Haskell with a type-and-effect system, to address Haskell's difficulties in reasoning about lazy evaluation and in using traditional data structures such as mutable arrays.[74] He argues (p. 20) that "destructive update furnishes the programmer with two important and powerful tools ... a set of efficient array-like data structures for managing collections of objects, and ... the ability to broadcast a new value to all parts of a program with minimal burden on the programmer."

Robert Harper, one of the authors of Standard ML, has given his reasons for not using Haskell to teach introductory programming. Among these are the difficulty of reasoning about resource use with non-strict evaluation, that lazy evaluation complicates the definition of datatypes and inductive reasoning,[75] and the "inferiority" of Haskell's (old) class system compared to ML's module system.[76]

Haskell's build tool, Cabal, has historically been criticized for poorly handling multiple versions of the same library, a problem known as "Cabal hell". The Stackage server and Stack build tool were made in response to these criticisms.[77] Cabal itself now has a much more sophisticated build system, heavily inspired by Nix,[78] which became the default with version 3.0.

[edit]

Clean is a close, slightly older relative of Haskell. Its biggest deviation from Haskell is in the use of uniqueness types instead of monads for input/output (I/O) and side effects.

A series of languages inspired by Haskell, but with different type systems, have been developed, including:

  • Agda, a functional language with dependent types.
  • Cayenne, with dependent types.
  • Elm, a functional language to create web front-end apps, no support for user-defined or higher-kinded type classes or instances.
  • Epigram, a functional language with dependent types suitable for proving properties of programs.
  • Idris, a general purpose functional language with dependent types, developed at the University of St Andrews.
  • PureScript transpiles to JavaScript.
  • Ωmega, a strict language that allows introduction of new kinds, and programming at the type level.

Other related languages include:

  • Curry, a functional/logic programming language based on Haskell.

Notable Haskell variants include:

  • Generic Haskell, a version of Haskell with type system support for generic programming.
  • Hume, a strict functional language for embedded systems based on processes as stateless automata over a sort of tuples of one element mailbox channels where the state is kept by feedback into the mailboxes, and a mapping description from outputs to channels as box wiring, with a Haskell-like expression language and syntax.

Conferences and workshops

[edit]

The Haskell community meets regularly for research and development activities. The main events are:

Starting in 2006, a series of organized hackathons has occurred, the Hac series, aimed at improving the programming language tools and libraries.[80]

References

[edit]
  1. ^ a b c Hudak et al. 2007.
  2. ^ a b Marlow, Simon (24 November 2009). "Announcing Haskell 2010". Haskell (Mailing list). Retrieved 12 March 2011.
  3. ^ a b Riedel, Herbert (28 April 2016). "ANN: Haskell Prime 2020 committee has formed". Haskell-prime (Mailing list). Retrieved 6 May 2017.
  4. ^ a b c d e f g h i j k l m Peyton Jones 2003, p. xi
  5. ^ Norell, Ulf (2008). "Dependently Typed Programming in Agda" (PDF). Gothenburg: Chalmers University. Retrieved 9 February 2012.
  6. ^ Hudak et al. 2007, pp. 12–38, 43.
  7. ^ Stroustrup, Bjarne; Sutton, Andrew (2011). "Design of Concept Libraries for C++" (PDF). Software Language Engineering. Archived from the original (PDF) on 10 February 2012.
  8. ^ a b c d e f g h i j Hudak et al. 2007, pp. 12-45–46.
  9. ^ a b Meijer, Erik (2006). "Confessions of a Used Programming Language Salesman: Getting the Masses Hooked on Haskell". Oopsla 2007. CiteSeerX 10.1.1.72.868.
  10. ^ Meijer, Erik (1 October 2009). "C9 Lectures: Dr. Erik Meijer – Functional Programming Fundamentals, Chapter 1 of 13". Channel 9. Microsoft. Archived from the original on 16 June 2012. Retrieved 9 February 2012.
  11. ^ Drobi, Sadek (4 March 2009). "Erik Meijer on LINQ". InfoQ. QCon SF 2008: C4Media Inc. Retrieved 9 February 2012.{{cite news}}: CS1 maint: location (link)
  12. ^ Hickey, Rich. "Clojure Bookshelf". Listmania!. Archived from the original on 3 October 2017. Retrieved 3 October 2017.
  13. ^ Heller, Martin (18 October 2011). "Turn up your nose at Dart and smell the CoffeeScript". InfoWorld. Retrieved 2020-07-15.
  14. ^ "Declarative programming in Escher" (PDF). Retrieved 7 October 2015.
  15. ^ Syme, Don; Granicz, Adam; Cisternino, Antonio (2007). Expert F#. Apress. p. 2. F# also draws from Haskell particularly with regard to two advanced language features called sequence expressions and workflows.
  16. ^ "Facebook Introduces 'Hack,' the Programming Language of the Future". WIRED. 20 March 2014.
  17. ^ "Idris, a dependently typed language". Retrieved 26 October 2014.
  18. ^ "LiveScript Inspiration". Retrieved 4 February 2014.
  19. ^ Freeman, Phil (2016). "PureScript by Example". Leanpub. Retrieved 23 April 2017.
  20. ^ Kuchling, A. M. "Functional Programming HOWTO". Python v2.7.2 documentation. Python Software Foundation. Retrieved 9 February 2012.
  21. ^ "Glossary of Terms and Jargon". Perl Foundation Perl 6 Wiki. The Perl Foundation. Archived from the original on 21 January 2012. Retrieved 9 February 2012.
  22. ^ "Influences - The Rust Reference". The Rust Reference. Retrieved 31 December 2023.
  23. ^ Fogus, Michael (6 August 2010). "MartinOdersky take(5) toList". Send More Paramedics. Retrieved 9 February 2012.
  24. ^ Lattner, Chris (3 June 2014). "Chris Lattner's Homepage". Chris Lattner. Retrieved 3 June 2014. The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  25. ^ Chevalier, Tim (28 January 2008). "anybody can tell me the pronunciation of "haskell"?". Haskell-cafe (Mailing list). Retrieved 12 March 2011.
  26. ^ Type inference originally using Hindley-Milner type inference
  27. ^ a b c Peyton Jones 2003.
  28. ^ Edward Kmett, Edward Kmett – Type Classes vs. the World
  29. ^ Mossberg, Erik (8 June 2020), erkmos/haskell-companies, retrieved 22 June 2020
  30. ^ O'Sullivan, Bryan; Goerzen, John; Stewart, Donald Bruce (15 November 2008). Real World Haskell: Code You Can Believe In. "O'Reilly Media, Inc.". pp. xxviii–xxxi. ISBN 978-0-596-55430-9.
  31. ^ "Haskell in Production: Riskbook". Serokell Software Development Company. Retrieved 7 September 2021.
  32. ^ "PYPL PopularitY of Programming Language index". pypl.github.io. May 2021. Archived from the original on 7 May 2021. Retrieved 16 May 2021.
  33. ^ Frederickson, Ben. "Ranking Programming Languages by GitHub Users". www.benfrederickson.com. Retrieved 6 September 2019.
  34. ^ a b c Peyton Jones 2003, Preface.
  35. ^ Wadler, Philip (October 1988). "How to make ad-hoc polymorphism less ad hoc".
  36. ^ Peyton Jones, Simon (2003). "Wearing the hair shirt: a retrospective on Haskell". Microsoft.
  37. ^ "Haskell Wiki: Implementations". Retrieved 18 December 2012.
  38. ^ "Welcome to Haskell'". The Haskell' Wiki. Archived from the original on 20 February 2016. Retrieved 11 February 2016.
  39. ^ GHC 2020 Team (29 October 2021) GHC 9.2.1 released
  40. ^ Proposed compiler and language changes for GHC and GHC/Haskell
  41. ^ Wadler, P.; Blott, S. (1989). "How to make ad-hoc polymorphism less ad hoc". Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '89. ACM. pp. 60–76. doi:10.1145/75277.75283. ISBN 978-0-89791-294-5. S2CID 15327197.
  42. ^ Hallgren, T. (January 2001). "Fun with Functional Dependencies, or Types as Values in Static Computations in Haskell". Proceedings of the Joint CS/CE Winter Meeting. Varberg, Sweden.
  43. ^ Computer Language Benchmarks Game
  44. ^ "HackageDB statistics". Hackage.haskell.org. Archived from the original on 3 May 2013. Retrieved 26 June 2013.
  45. ^ "Implementations" at the Haskell Wiki
  46. ^ "The LLVM Backend". GHC Trac. 29 March 2019.
  47. ^ Terei, David A.; Chakravarty, Manuel M. T. (2010). "An LLVM Backend for GHC". Proceedings of ACM SIGPLAN Haskell Symposium 2010. ACM Press.
  48. ^ C. Ryder and S. Thompson (2005). "Porting HaRe to the GHC API"
  49. ^ Utrecht Haskell Compiler
  50. ^ Hudak et al. 2007, pp. 12–22.
  51. ^ Agda 2, Agda Github Community, 15 October 2021, retrieved 16 October 2021
  52. ^ "The Haskell Cabal". Retrieved 8 April 2015.
  53. ^ "Linspire/Freespire Core OS Team and Haskell". Debian Haskell mailing list. May 2006. Archived from the original on 27 December 2017. Retrieved 14 June 2006.
  54. ^ "Live code with Tidal Cycles". Tidal Cycles. Retrieved 19 January 2022.
  55. ^ xmonad.org
  56. ^ "Gargantext – Main". 13 July 2023.
  57. ^ David, Chavalarias; et al. (8 May 2023). Toward a Research Agenda on Digital Media and Humanity Well-Being (report).
  58. ^ "Fighting spam with Haskell". Facebook Code. 26 June 2015. Retrieved 11 August 2019.
  59. ^ "Open-sourcing Haxl, a library for Haskell". Facebook Code. 10 June 2014. Retrieved 11 August 2019.
  60. ^ "input-output-hk/cardano-node: The core component that is used to participate in a Cardano decentralised blockchain". GitHub. Retrieved 18 March 2022.
  61. ^ Parsing, analyzing, and comparing source code across many languages: github/semantic, GitHub, 7 June 2019, retrieved 7 June 2019
  62. ^ "Commercial Users of Functional Programming Workshop Report" (PDF). Retrieved 10 June 2022.
  63. ^ a b c d A formal proof of functional correctness was completed in 2009. Klein, Gerwin; Elphinstone, Kevin; Heiser, Gernot; Andronick, June; Cock, David; Derrin, Philip; Elkaduwe, Dhammika; Engelhardt, Kai; Kolanski, Rafal; Norrish, Michael; Sewell, Thomas; Tuch, Harvey; Winwood, Simon (October 2009). "seL4: Formal verification of an OS kernel" (PDF). 22nd ACM Symposium on Operating System Principles. Big Sky, Montana, USA.
  64. ^ "Tikhon Jelvis: Haskell at Target". YouTube. 22 April 2017.
  65. ^ "Why Co–Star uses Haskell". Co–Star. Retrieved 30 September 2023.
  66. ^ "Haskell in Production: Mercury". Serokell. Retrieved 11 October 2024.
  67. ^ "Web/Frameworks – HaskellWiki". wiki.haskell.org. Retrieved 17 September 2022.
  68. ^ Jan-Willem Maessen. Eager Haskell: Resource-bounded execution yields efficient iteration. Proceedings of the 2002 Association for Computing Machinery (ACM) SIGPLAN workshop on Haskell.
  69. ^ [dead link]Simon Peyton Jones. Wearing the hair shirt: a retrospective on Haskell. Invited talk at POPL 2003.
  70. ^ "Lazy evaluation can lead to excellent performance, such as in The Computer Language Benchmarks Game". 27 June 2006.
  71. ^ Heeren, Bastiaan; Leijen, Daan; van IJzendoorn, Arjan (2003). "Helium, for learning Haskell" (PDF). Proceedings of the 2003 ACM SIGPLAN workshop on Haskell. pp. 62–71. doi:10.1145/871895.871902. ISBN 1581137583. S2CID 11986908.
  72. ^ "Helium Compiler Docs". GitHub. Retrieved 9 June 2023.
  73. ^ "DDC – HaskellWiki". Haskell.org. 3 December 2010. Retrieved 26 June 2013.
  74. ^ Ben Lippmeier, Type Inference and Optimisation for an Impure World, Australian National University (2010) PhD thesis, chapter 1
  75. ^ Robert Harper (25 April 2011). "The point of laziness". Closed access icon
  76. ^ Robert Harper (16 April 2011). "Modules matter most". Closed access icon
  77. ^ "Solving Cabal Hell". www.yesodweb.com. Retrieved 11 August 2019.
  78. ^ "Announcing cabal new-build: Nix-style local builds". Retrieved 1 October 2019.
  79. ^ https://zfoh.ch/ [bare URL]
  80. ^ "Hackathon – HaskellWiki".

Bibliography

[edit]
Reports
Textbooks
Tutorials
History
[edit]