Chapter 6. Modules

A Haskell module is essentially a file that defines some functions, types, and type classes. A Has-kell program is a collection of modules.

image with no caption

A module can have many functions and types defined inside it, and it exports some of them. This means that it makes them available for the outside world to see and use.

Having code split up into several modules has many advantages. If a module is generic enough, the functions it exports can be used in a multitude of different programs. If your own code is separated into self-contained modules that don’t rely on each other too much (we also say they are loosely coupled), you can reuse them later. ...

Get Learn You a Haskell for Great Good! now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.