Creating Your Own Modules

Importing modules defined by libraries is a great starting point when you are building an application, but as your programs start to grow larger, you’ll also quickly realize that you’ll need to use them in your own application to help you organize and re-use your own code. Modules are the basic unit of organization in Haskell applications, and in this section, you’ll learn how to write modules, control what they export, and how to design an application to make the best use of modules so that your code is easy to use and re-use.

Let’s start by looking at how we can create a module. Haskell modules are closely related to individual source files. Each file contains one module, and each module is defined by a single file. ...

Get Effective 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.