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 live online training, plus books, videos, and digital content from nearly 200 publishers.