Export two modules from one.hs file?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Export two modules from one.hs file?

Leonhard Applis
Hey  All,

I currently want to make a module, which "truly" exposes 3 functions. However, there are more functions which I want to test.
I would like to export two modules from the same file, "ModuleToUse" and "ModuleOpen".
Then I can use ModuleToUse everywhere else, and ModuleOpen in the UnitTests.

I know I can declare ModuleOpen, and export only certain functions with ModuleToUse.
But I am not sure, if that is a smart / normal thing to do. In my case this would double my modules, and ... hence files?

What is the "real world" approach for this?

Thanks
Leonhard




_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

publickey - Leonhard.Applis@protonmail.com - 0x807FDDF3.asc (2K) Download Attachment
signature.asc (490 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Export two modules from one.hs file?

Francesco Ariis
Hello Leonard,

On Mon, Nov 18, 2019 at 08:42:22PM +0000, Leonhard Applis wrote:
> I currently want to make a module, which "truly" exposes 3 functions.
> However, there are more functions which I want to test.
> I would like to export two modules from the same file, "ModuleToUse"
> and "ModuleOpen".

Unfortunately Haskell (rather, GHC) in its current incarnation does
not allow many-modules-per-single-file (which would indeed come quite
handy in cases like yours, in writing example code, etc.).

> What is the "real world" approach for this?

Have two modules, `Prova` and `Prova.Internal` (files:
`src/Prova.hs` and `src/Prova/Intenral.hs`).j

Does this answer your question?
-F
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners