Lesson 34. Organizing Haskell code with modules

After reading lesson 34, you’ll be able to

  • Understand the main module implicitly used when you create a program
  • Create namespaces for your functions by using modules
  • Separate programs into multiple files
  • Selectively import functions from modules

Up to this point in the book, we’ve covered a wide range of interesting topics related to Haskell. But we haven’t discussed one of the most basic topics: creating namespaces for your functions. Haskell uses a system of modules to create separate namespaces for functions and allow you to organize your code much better. This works similarly to modules in languages such as Ruby and Python, and to packages and namespaces in languages such as Java and C#. ...

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.