Haskell exports a large number of functions

I am writing a module that has a fairly large number of functions that need to be exported. This module also has a large number of data constructions.

Suppose my module contains the following:

module MyUtils (A(..), B(..),C(..),D(..),f1,f2,f3,f4,f5,f6) where --Data constructors data A = ... data B = ... data C = ... data D = ... --functions f1 :: A -> B f2 :: A -> B -> C f3 :: A -> B -> D f4 :: A -> B -> A f5 :: A -> B -> B f6 :: A -> B 

I saw the source of Data.Map here. It shows that it exports a large number of functions to a very large list.

But if I want to export everything, this can be done using the shortcut method, something like

 module MyUtils (..) where 

?

+7
module export haskell
source share
1 answer

Yes, just leave (..) completely. By default, all names are exported.

 module MyUtiles where ... 

If there are a large number of functions that you want to export next to a small number of functions that you want to hide, it is best to put the hidden ones in another module and import it.

+11
source share

All Articles