Summary

This chapter explored some key language extensions and the design patterns associated with them. In particular, we looked at language extensions related to functions, datatypes, and type­classes and encountered two major costs of language extensions:

  • impaired type inference (requiring more type annotations)
  • affinity to compiler implementations (decreasing portability of code across compilers)

Language extensions make Haskell more powerful but also more complex, hence the sentiment:

 

"Whenever you add a new feature to a language, you should throw out an existing one (especially if the language at hand is named after a logician)"

 
 --Fun with Phantom Types, Hinze

Get Haskell Design Patterns 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.