concept module in category idris

appears as: module, Modules
Type-Driven Development with Idris

This is an excerpt from Manning's book Type-Driven Development with Idris.

Listing 2.7 also introduces the module and export keywords. A module declaration can optionally be put at the top of a file. This declares a namespace in which every function is defined. Conventionally, module names are the same as the filename (without the .idr extension). The export keyword allows the average function to be used by other modules that import Average.idr.

The Idris base library provides a module, System.Concurrency.Channels, that contains primitives for starting concurrent processes and for allowing those processes to communicate with each other. This allows you, in theory, to write applications that make efficient use of your CPUs and that remain responsive even when executing complex calculations.

The next listing shows the overall structure of the module, omitting the definitions but adding export modifiers to each declaration.

Listing 15.16. Defining Process in a module, omitting definitions (ProcessLib.idr)