Skip to content

Instantly share code, notes, and snippets.

@wrhall
Last active February 12, 2016 20:15
Show Gist options
  • Save wrhall/820bece1df85de3f6696 to your computer and use it in GitHub Desktop.
Save wrhall/820bece1df85de3f6696 to your computer and use it in GitHub Desktop.
Complete Beginners Guide to Learning Haskell

I've thought about it a little, and here are my ideas about some good starting points for a new Haskeller. Note -- this is not meant to be a list of every blog or article about haskell.

It isn't trying to point to every tutorial or language reference. It is trying to describe a roughly linear path a newcomer to Haskell could follow without ever feeling completely over their head.

With that in mind, please tweet any suggestions for additional content to @wrhall (or fork!)

Complete beginner

Great starting point, learnxinyminutes. This is a good way to see some code in action. http://learnxinyminutes.com/docs/haskell/

It also includes a good link at the bottom: http://learnyouahaskell.com/introduction#about-this-tutorial

Some good points of reference

At any point here, you should probably explore the haskell documentation. It's pretty great, and then you can sort of choose your own adventure. First, if you're looking for what a haskell command does, hoogle can be a good referenc: http://www.haskell.org/hoogle/

Otherwise, just google fun things like "haskell garbage collection" to learn about ghc.

Second, the wiki just has great stuff. Browse around it and see what you can find.

Another really complete reference: "What I wish I knew when learning Haskell 2.0" http://dev.stephendiehl.com/hask/ It would also be a good idea to look at Typeclassopedia [as recommended by the above], although Dustin M thinks that presents concepts a bit out of order. Eg if you're familiar with Group Theory, a Monoid is probably less scary than a Functor [namely, a monoid is a group without inverses].

But functors aren't too scary, either, and the Typeclassopedia does a good job introducing them.

In particular, it does a nice job discussing monads. (and it provides the type signatures if you need to look back)

More about monads: a ucsd lecture

Functors and F-Algebras

Functors

Then you might be wondering about functors. And this one is probably a link to be read many many times.

http://patrickthomson.ghost.io/an-introduction-to-recursion-schemes/

F-Algebras

Similar, but possibly more complex than the above:

https://www.fpcomplete.com/user/bartosz/understanding-algebras

Category Theory

It might be worth checking out this intro to Category Theory [especially if the programmer is already familiar with C++].

http://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/

Sorting, seen functionally

There was a pretty great talk about Haskell + different sorting algorithms at the NYC Haskell meetup. The paper can be found here: http://www.cs.ox.ac.uk/people/daniel.james/sorting.html

A note about Lenses

Lenses are the Haskell way of getting and setting properties on [potentially nested] struct-likes. If you're wondering why they are complicated or fancy, it's because when you make an immutable language, a number of things become really easy while some easy things become surprisingly difficult. Getting / Setting stuff is a simple idea that becomes difficult. (and of course, for setters, what really happens is that you make a copy with the tiny mutation)

The canonical Lens library right now is by Kmett. An interesting illustration of how complex Lenses are is just the fact that Kmett's library currently ends up with most of the Haskell Platform as a dependency.

Functional Reactive Programming

Functional reactive programming is a paradigm for event-driven programming. Data in UIs can be live-updated through simple associations, and events are dealt with individually as they arrive. A Haskell FRP framework that works with GHCJS is Reflex by Ryan Trinkle.

Hm. To be continued?

Purely functional Data Structures

http://cstheory.stackexchange.com/questions/1539/whats-new-in-purely-functional-data-structures-since-okasaki

Obviously, one should probably try to read as much of Okasaki as they can. It's a great primer to purely functional data structures and analysis of laziness. Also, see this post about deamortized ST by Edward Kmett.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment