O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 23Haskell’s Type System

by Paul Callaghan

Imagine an approach to programming where you write down some description of what your code should do, then before running your code, you run some automatic tool to see if the code matches the description. That’s test-driven development, you say!

Actually, this is what you’re doing when you use static types in most languages too. Types are a description of the code’s inputs and outputs, and the check ensures that inputs and outputs match up and are used consistently. Modern type systems—such as in Haskell—are very flexible and allow these descriptions to be quite detailed; plus, they aren’t too obtrusive in use and often very helpful.

One point I’ll investigate here is how advances in types ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required