Lesson 11. Type basics

After reading lesson 11, you’ll be able to

  • Understand basic types in Haskell, including Int, String, and Double
  • Read type signatures for functions
  • Use simple type variables

This lesson introduces one of the most powerful aspects of Haskell: its robust type system. The fundamentals of functional programming covered in the preceding lessons are shared by all functional programming languages from Lisp to Scala. It’s Haskell’s type system that sets it apart from other programming languages. Our introduction in this lesson starts with the basics of Haskell’s type system.

Consider this

You need to create a simple function for taking the average of a list of numbers. The most obvious solution is to take the sum ...

Get Get Programming with Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.