roam/WillKurt2718.org

1.7 KiB
Raw Permalink Blame History

Notes on Will Kurt, Get Programming with Haskell

Functional Programming

John Backus, who led the team that created Fortran, asked in his Turing Award lecture, “Can programming be liberated from the von Neumann style?”

This question leads to the second way to understand programming, which is the subject of the first unit in this book. Functional programming attempts to liberate programming from the von Neumann style.

Algebraic Data Types

The big problem is that you want a single type that represents both vinyl records and books so you can make a searchable inventory. Because you can compose types only by and, you need to develop an abstraction that describes everything that records and books have in common. Youll then implement only the differences in the separate classes. This is the fundamental idea behind inheritance.

In theory, creating object hierarchies is elegant and captures an abstraction about how everything in the world is interrelated. In practice, creating even trivial object hierar- chies is riddled with design challenges. The root of all these challenges is that the only way to combine types in most languages is with an and. This forces you to start from extreme abstraction and move downward. Unfortunately, real life is full of strange edge cases that make this much more complicated than youd typically want.