Haskell is a purely FunctionalProgrammingLanguage
(typically implemented as LazyEvaluation
) and a polymorphic type system (an extension of the classical HindleyMilnerTypeInference
algorithm). It was named after HaskellCurry
and the HaskellWiki
Some nice features:
- Functions can be defined by PatternMatching, as in several other functional languages.
- ListComprehensions provide a nice way to write mapping and filtering operations.
- Syntactic support for a simple variety of LiterateProgramming.
- You can define your own infix operators.
- TypeClasses allow the introduction of overloaded functions.
- Readily available package system, HackageDb? (http://hackage.haskell.org) and user-side tool 'cabal', with thousands of open-source packages.
- Indentation-sensitive syntax and curly brace syntax are both possible, depending on your preference.
I/O is done via monads (see OnMonads
). Monads (which have far wider applications than just I/O) are hard for some to grasp, but there are a lot of good tutorials right now on the net that deal with them. A good place to start is http://www.haskell.org/learning.html
has a small tutorial on Haskell (http://gnosis.cx/publish/programming/Haskell.pdf
maintains a growing "Online Bibliography of Haskell Research" at http://haskell.readscheme.org/
that references many research papers about monads and their even more abstract and scary generalization, arrows. HaskellArrows
were introduced by JohnHughes
and are also explained at http://www.haskell.org/arrows/
In "Wearing the hair shirt: a retrospective on Haskell" (2003, available as a set of PowerPoint
slides at http://www.research.microsoft.com/~simonpj/papers/haskell-retrospective/
provides an overview of the (rather short) history of Haskell. He concludes that LazyEvaluation
is rather less important than one might think while purity and type classes and monads are essential. "Our biggest mistake: using the scary term 'Monad' rather than 'Warm Fuzzy Thing'
Haskell now has its very own International Obfuscated Code Contest (see http://www.ScannedInAvian.org/iohcc/
BrokenLink as of 16 February 2010, but available through WaybackMachine at http://web.archive.org/web/20050409013040/www.scannedinavian.org/iohcc/.
And its very own Lambdacats site (see http://arcanux.org/lambdacats.html
for a short example of Haskell code. See TheEvolutionOfaHaskellProgrammer
for some more examples.
Some people are running the LanguageOfTheYear?
project over on the Pragmatic Programmer mailing list and chose Haskell as LanguageOfTheYear?
2002. Check it out: http://groups.yahoo.com/group/pragprog
IBM article In 2001 (http://www-106.ibm.com/developerworks/xml/library/x-matters14.html
) advocated use of HaskellLanguage
to overcome the limitations of XML processing tools. Is his idea a flash in the pan? Are there better alternatives to DOM/SAX/XSLT?
The combinators of HaXml
are designed to do about the same thing as XSLT. However, have you ever tried using XSLT? Anything that does the same will be simpler and easier to use. HaXml
, being embedded in Haskell gives the full power of a programming language on top of the easy XML transformations. Another popular Haskell XML library is HXT, which is also notable in that one way to use it is through its arrow-based API.
Is there a good IDE usable for Haskell under Windows?
(mentions hIDE and jCreator)
I've also heard of editor support in jEdit, Eclipse, and some other editors. I'm mostly happy with the haskell-mode in Emacs.
See also http://www.haskell.org/visualhaskell/ for a Haskell plugin for VisualStudio (not to be confused with a similar project at http://www.cin.ufpe.br/~haskell/vhs/index.html). This plugin ties directly into the GHC compiler, providing all of the usual VS features like syntax highlighting and name completion, but it also goes a step further. If the plugin doesn't squiggly-highlight any code in your program, it is guaranteed to compile with GHC. -- MichaelSparks
I love Haskell mostly for the elegant and beautiful syntax you get when doing PointFreeProgramming?
. However, Haskell's strict FP discipline and affinity for abstruse concepts like Arrows really hurts when trying to put together quick scripts, or when just hacking for fun. Are there other languages that support the inline . and $ operators or other syntax like it? I just can't go back to (compose #'foo #'bar) after getting used to foo . bar, to say nothing of all the fun with the $ operator in avoiding needless parenthesis.
- You might find ConcatenativeLanguages interesting, such as ForthLanguage, JoyLanguage, or FactorLanguage. Unlike ApplicativeLanguage?s, juxtaposition of symbols indicates a composition operation (e.g., A B means to compute A first, then compute B on A's results; this is equivalent to B $ A or B . A in Haskell, depending on your precise context). -- SamuelFalvo?
... I suppose I can't hold my breath on that, since to get point-free programming, I also need automatic currying, which I've only seen in MlLanguage
s. I suppose I can live with SmlLanguage
and the 'o' operator, but no $ operator I'm aware of.
Abstruse concepts? I have a whole book about abstruse concepts sitting on my shelf, only it's imported from that other, backwards world, where functions are only known as methods and abstruse concepts are sold as Design Patterns, where the capital letters apparently enchant them into something desirable... Really, compared to RubeGoldbergDevices? like Visitor, Arrows and Monads are astonishingly simple. Perhaps that's why imperative programmers distrust these powerful structures.
That would make a nice T-shirt:
"I have the GONADS to work with MONADS."
With languages with pervasive effects such as C, you need machinery such as Hoare logic to handle proofs about programs. One of the benefits of Haskell's purity is that its expressions are already in the right form for traditional mathematical proof. You can even use Haskell functions in specifications because they are pure.
folks have apparently standardized on Haskell for core operating system development. See http://urchin.earth.li/pipermail/debian-haskell/2006-May/000169.html
A useful reference to details of Haskell is at http://www.zvon.org/other/haskell/Outputglobal/index.html
See also TemplateHaskell
CategoryProgrammingLanguage FunctionalProgrammingLanguage CategoryHaskell CategoryFunctionalProgramming CategoryLiterateProgramming