My aim here is to create a reference document for common functions, types, and typeclasses in the style of MDN.
Disclaimer: The following text is opinion.
- 1 Rationale
- 2 So where now?
In my opinion, Haskell is a fantastic language which produces code that has many advantages over other programming languages including:
- Highly expressive syntax
- Strong typing
- Easy parameterised functions, and interfaces
- Fast compared to other high level languages.
- Wide range of well-written libraries
- Based on sound mathematical theory and computer science
... and many others. Unfortunately Haskell has one major disadvantage which overcomes most of it's advantages: Haskell is difficult to learn.
Haskell is not a beginners language
Nobody learns Haskell as a first language. Some people learn other functional programming languages like Lisp, but Haskell is a language by the wayside. Haskell is not accessible. Most pathways of learning Haskell come in the form of tutorials, and most (all?) of these require background knowledge
Learning Haskell is difficult as a second, third, fourth, nth language
On the back cover of the book "Real World Haskell" is says: "when you have worked through the pages of this book, you'll write better code in your current favorite language". Haskell is mainly used in academia rather than in mainstream practice, but to make Haskell a more popular language, it needs to be accessible. Haskell turns your ideas of programming upside-down and perhaps the best people to teach would be those who have an open mind and have no preconceptions of what programming entails.
Tutorials are not (necessarily) the best way to learn
Tutorials are abundant in the Haskell ecosystem, but they are not the be all and end all. Tutorials are not going to fit every style of learning, and one of the problems with tutorials is that they assume knowledge from earlier in the tutorial. If you're just looking for a single piece of information, it may be difficult to find, or hidden in a part where you wouldn't expect.
Haskell lacks a good "reference" style documentation of common functions which are commonly used but hard for a beginner to get their head around. It's often easier (at least for me) currently to look at the source code itself to figure out what is actually going on. Most other programming languages have a well documented interface which spares the programmer learning unnecessary implementation details.
Perhaps we need to start from "Hello World!"
This is likely an unpopular opinion. To fully understand a hello world program in Haskell you need to have knowledge of Monads, IO, do notation and others. Frankly, "Hello World" in C++ is similarly horrific, with operator overloading, namespaces, classes and OOP, CPP directives, arrays and pointers (argv). Yet, still, C++ is often taught as a first language.
Programmers do not need to understand the implementation details of the language to write code, they just need to have some idea of how the code behaves. OOP made implementation details unimportant, but behavior a first class citizen, and similar constructs can be applied to Haskell.
You need bad programmers before you get good ones
In order to get good programmers, first you're going to need bad ones. There's no point trying to have a high barrier of entry to weed out potential users of a language if that means you have none at all. Frankly, the more programmers the better, regardless of quality.
So where now?
My aim is to produce documentation in a similar way, and in similar detail to other languages for common functions, typeclasses and types (essentially those in base, especially Prelude) and present it in a form in which a programmer can quickly google and find the answer they're looking for. The aim of this is to make Haskell a more accessible language for all.
There are many projects which can make Haskell more accessible. In my opinion these projects would be: webasm as a compilation target for GHC, better GUI bindings, a language reference or tutorial which is aimed at beginners, and a language reference which is more readable and easier to digest than the Haskell report.
If you have any questions, please contact me on reddit: my username is pilotInPyjamas