Issue 77 2017-10-19
Welcome to another issue of Haskell Weekly! Haskell is a safe, purely functional programming language with a fast, concurrent runtime. This is a weekly summary of what’s going on in its community.
It’s like driving a car down the road, having a new engine fall into your lap, installing it on-the-fly, and dumping the old engine behind you, all while never touching the brakes.
Hopefully these tips will help provide some guard rails for learning the language for the first time. That’s not to say that Haskell is perfect, but I think you will enjoy the language if you avoid these common beginner pitfalls.
The point about this is that no one is in disagreement about how good a language Haskell is for doing real work. Rather, the question is about whether the principles that Haskell is built on get obscured by the fact it’s a large and complicated language.
Classes from Object-oriented programming languages such as C++ allow types to declare a pre-selected list of overridable functions. Typeclasses in Haskell are a general-purpose way to write functions whose implementations change depending on the type of a parameter.
In retrospect, my inclination to use typeclasses in inappropriate ways was a big problem in my earlier Haskell days. I made this mistake a lot: I thought Java interfaces mapped to Haskell typeclasses. But really, more often they map to Haskell records.
I will show you how it is possible to write object-oriented code in Haskell using only a minimal set of utility code, and without giving up much of Haskell’s pure functional benefits.
If pushing responsibility forward means accepting whatever parameters and having the caller of the code handle possibility of failure, then pushing it back is going to mean we accept stricter parameters that we can’t fail with.
Tagged unions are a killer language feature as they allow you to expressively model problem domains and avoid some of the pitfalls of relying entirely on primitives.
It can feel a bit like a small child trying to push a star-shaped thing through the square-shaped hole. The types are the holes that guide how you insert code and values.
We need a solid, reliable, well-engineered, predictable GHC toolchain; and we need to achieve that without compromising GHC innovation and vitality.
Are you looking to hire a Haskell developer? If so, advertise with us!
- ALGT2: A tool to specify arbitrary programming languages
- Computational geometry: Set operations on polytopes
- Growing a date picker in Reflex: Part 2
- Haskell eXchange 2017 videos
- hs-init: A tool for creating batteries-included Haskell projects
- LambdaConf 2017 videos
- Ordered-indexed graphs with lenses: Looking for feedback
Package of the week
This week’s package of the week is tagged, a library providing phantom types to avoid unsafely passing dummy arguments.
Call for participation
- herms: Convert oven temperatures in recipe directions between Fahrenheit and Celsius
- hs-init: Update
bscript for 8.2.1 ghc version
- servant-auth: Prepare to be official
- Yampa: maybeToEvent not exported
Looking for something to contribute to? Check out the Hacktoberfest issues on GitHub!