It is possible to export no names of a module by specifying just a pair of parenthesis as the export list:
module MyModule () where
In which scenarios would this be useful? As far as I understand, any file importing MyModule
won't be able to use any functions or types declared inside MyModule
. At this point is seems like a useless feature of the langauge, but I suppose it is there for a reason.
Such a module will still export any class instances defined therein.
module A where
class Foo f where
foo :: f
data Bar = Bar deriving (Show)
module B () where
import A
instance Foo Bar where
foo = Bar
module C where
import A
import B -- won't compile without this import!
main = print (foo :: Bar)
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