A Gentle Introduction to Haskell, Version 98
This is the master HTML version of the Gentle Introduction To Haskell, version 98. Revised June, 2000 by Reuben Thomas. You may download the following: Brief Table of Contents. All code in this tutorial, with additional commentary, is found in the code directory packaged with this tutorial. Premission is granted to correct, improve, or enhance this document. Copyright (C) 1999 Paul Hudak, John Peterson and Joseph Fasel Permission is hereby granted, free of charge, to any person obtaining a copy of "A Gentle Introduction to Haskell" (the Text), to deal in the Text without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Text, and to permit persons to whom the Text is furnished to do so, subject to the following condition: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Text.
(1)
Stephen Diehl (@smdiehl ) Since I wrote these slides for a little user group talk I gave two years ago they have become a surprisingly popular reference. I decided to actually turn them into a proper skimmable reference for intermediate level Haskell topics that don't necessarily have great coverage or that tend be somewhat opaque as to where to get going, and then aggregate a bunch of the best external resources for diving into those subjects with more depth. Hopefully it still captures the "no bullshit brain dump" style that seemed to be liked. The source for all snippets is available here. To start a new Haskell project run $ cabal init $ cabal configure A .cabal file will be created. Sandboxes ( in cabal > 1.8 ) are self contained environments of Haskell packages. $ cabal sandbox init To update the package index from Hackage. $ cabal update To install the dependencies for the package: $ cabal install --only-dependencies To run the "executable" for a library under the cabal sandbox: Exceptions
Haskell: The Confusing Parts
If you’re used to the C family of languages, or the closely related family of “scripting languages,” Haskell’s syntax (mainly) is a bit baffling at first. For some people, it can even seem like it’s sneaking out from under you every time you think you understand it. This is sort of a FAQ for people who are new to Haskell, or scared away by its syntax. Use this as a cheat sheet, not a textbook. Misc. Quick review, because if you’ve heard of Haskell, you should also have heard of most of this. foo :: Bar baz -> Bar quux is a type signature for the function foo, where Bar baz is the type of argument it takes, and Bar quux is the type of the return value. There’s no null and no void. Haskell’s syntax is indirectly based on ML, so if you stop reading here and go learn OCaml instead, some of this information will still be kinda useful. Type Names and Constructors There are two completely separate namespaces in any Haskell source file: The value namespace, and the type namespace. Statements vs.
dev.stephendiehl.com/hask/
Version 2.3 Stephen Diehl (@smdiehl ) This is the fourth draft of this document. License This code and text are dedicated to the public domain. You may copy and paste any code here verbatim into your codebase, wiki, blog, book or Haskell musical production as you see fit. PDF Version PDF Version Changelog Alternate Preludes (Updated)NumDecimals extensionutf8-stringfoundationbase64-bytestringsafe-exceptionsrecrusion-schemes (Updated)Data types a la carteCoerciblegenerics-sopZ3Time complexity for data structuresFingertreeVaultCryptography sectioncryptoniteentropymemoryCompression sectionlz4zlibDate & Time sectionhourglassServantNames for FreeAbstract Binding Treesde Bruijn Indiceswl-pprint-text (Updated)pretty-showAdjunctionsCartesian Closed CategoriesMonoidal CategoriesNew langauge comparisons (Koitlin, Lua, etc) Sections that have had been added or seen large changes: Cabal Historically Cabal had a component known as cabal-install that has largely been replaced by Stack. See: Stack Install Usage Vim
lisperati.com/haskell/
There's other tutorials out there, but you'll like this one the best for sure: You can just cut and paste the code from this tutorial bit by bit, and in the process, your new program will create magically create more and more cool graphics along the way... The final program will have less than 100 lines of Haskell[1] and will organize a mass picnic in an arbitrarily-shaped public park map and will print pretty pictures showing where everyone should sit! (Here's what the final product will look like, if you're curious...) The code in this tutorial is a simplified version of the code I'm using to organize flash mob picnics for my art project, picnicmob... [1] - Lines of active code only, not counting optional function signatures.
Speeding Through Haskell
bob.ippoli.to/haskell-for-erlangers-2014/#/title
Bob Ippolito (@etrepum) Erlang Factory SF March 7, 2014 bob.ippoli.to/haskell-for-erlangers-2014 Not classically trained in CSErlang user since 2006 (Mochi Media, mochiweb, etc.)Haskell user since 2012 (ported exercism.io curriculum)Currently teaching web technologies to teenagers with Mission BitDoing a bit of advising/investing in startups I learn a lot of from studying new languagesTypes are supposed to help you write better softwareI like QuickCheck and DialyzerGood support for parallelism and concurrencyWill help me understand more CS papers RAM footprint per unit of concurrency (approx) Intimidated by Haskell for yearsTook a class while at FacebookRead several booksDeliberate practice Abstractions can often be used without penaltyEfficient parallel and concurrent programmingType system makes maintenance easierNice syntax (not too heavy or lightweight)Fantastic community & ecosystem More than a dozen non-strict FP languages in use FCPA '87 meeting (Peyton Jones, Hudak, et. al.) Internet Vim