I am writing a module which has rather large number of functions that need to be exported. Also this module 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 Data.Map source here It shows it is exporting a large number of functions in a very big list.
But If I want to export everything, can it be done with a yet shortcut method, something like,
module MyUtils (..) where
?
You can also also do it the following way:
module MyUtiles (module MyUtiles) where
It is sometimes desirable (or required) to use an export list. For example if you want to export everything in the current module and re-export bindings from another module.
Yes, just leave out the (..)
entirely. By default, all names are exported.
module MyUtiles where
...
If there are a large number of functions you want to export alongside a small number of functions you want to hide, it's best to put the hidden ones in another module and import it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With