O mica introducere in Haskell 98
m (→. Detalii)
m (→. Prefata (ro))
Revision as of 21:41, 28 July 2011
Volumul ”A Gentle introduction to Haskell 98” semnat de Paul Hudak, John Peterson, Joseph H. Fasel, care apare in toamna (2011) in traducere la Ed. [MatrixRom]. Este o lucrare celebra scrisa de o echipa absolut remarcabila de la Los Alamos Laboratory si Yale University.
1 . Foreword (en)
The May 1992 publication of ACM SIGPLAN Notices was a watershed moment for Haskell and its supporters. The May issue was devoted entirely to Haskell, thus introducing the language to the entire programming languages community in a visible, serious, professional way. It consisted of two parts: (1) The Haskell Report, the definitive language reference manual for the then new, pure, non-strict functional language designed by an international team of programming language experts (the Haskell Committee), and (2) A Gentle Introduction to Haskell, originally written by me and Joseph Fasel (of Los Alamos National Laboratory).
I think that the pair of documents has served each other, and the community, well -- one with all the gory detail of syntax and semantics, the other serving more as a tutorial for someone who is familiar with at least one other functional language. Some people have said that the tutorial is not so "gentle", but on the plus side it is relatively short, has a good set of examples, and is effective in teaching the basic concepts.
Indeed, over the years the "Gentle Intro" has taken on a life of its own. John Peterson (then at Yale) became a third author and made substantial contributions. It was converted to HTML and became a key reference on the haskell.org website for learning Haskell. As Haskell has evolved, so has the Gentle Intro, through contributions from a number of different people (for example, Reuben Thomas revised it considerably in June of 2000).
And now it is being translated into Romanian! It pleases me greatly to share the Gentle Intro with the Romanian programming languages community. (It has also been translated into French.) I'd like to thank Dan Popa, of the University of Bacau, for his effort in making this happen.
Haskell was a bold language design, even by today's standards. The Haskell Committee was unwavering in its commitment to purity, laziness, higher-order functions, and static typing. Questions about program behavior were always resolved through mathematical reasoning. And syntax was not an afterthought – considerable effort went into making Haskell a "beautiful" language.
Fortunately this boldness did not come with stubbornness. One of the most amazing things about Haskell is the way it evolved. More bold innovations, but all still motivated by the original design goals and justified by mathematical principles. The language changed quickly – it was no longer just the original Haskell Committee that made decisions – and it is still changing today.
The rapidity of change seems somewhat insane looking back. Indeed, the key element that held everything together was GHC, a Haskell compiler developed at the University of Glasgow by Simon Peyton Jones, who (with Simon Marlow) continues the effort to this day at Microsoft Research, Cambridge. The Simons’ willingness to try out new ideas by implementing them in GHC provided a solid test bed on which users could try out new ideas quickly and refine them as necessary.
Among the many innovations in Haskell, there are two that stand out: type classes and monads. And they represent two different categories of design: types and what I like to call computational abstractions. Haskell's type system today is able to express type constraints that we had no idea were possible when the language was first designed. Type classes, type families, functional dependencies, associated types, generalized algebraic data types, universally quantified types, polymorphic recursion, higher-ranked types, abstract types, higher-kinded quantification, lexically scoped type variables, multi-parameter type classes, and more. The Haskell type system contains an amazingly rich set of ideas, albeit daunting and overwhelming at times. The holy grail in this line of development would be the discovery of a streamlined design, a couple of small but powerful ideas that subsume all of the above.
The use of monads in Haskell, and in particular their use in I/O, motivated the design of special syntax, called "do notation”, to support monadic programming. A monad is an example of a computational abstraction, a reusable pattern that captures some notion of computation. For example, functors, applicative functors, catamorphisms, monads, and arrows form a set of increasingly general forms of computational abstraction, and a seasoned Haskell programmer carries these in her toolbox for use in a variety of applications. Of the ones listed above, two were considered so important as to design special syntax to facilitate their use, one being the "do notation” to support monads (as mentioned above), the other being "arrow syntax" to support arrows. It's hard to know where this line of development will lead, but further innovation is inevitable.
Alan Perlis, the first Turing Award winner, wrote in his famous Epigrams of Programming,
"A language that doesn't affect the way you think about programming is not worth knowing."
I hope that reading A Gentle Introduction to Haskell will make you think about your programming, perhaps open some doors that you didn't know existed, and lead to writing beautiful programs – the only ones worth writing!
New Haven, CT USA