Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding other files to haskell

Im writing app in haskell and I would like to export some functions and datatypes to other files and then be able to use them in my main file.

How to do this ?

thanks for help

like image 638
gruber Avatar asked Feb 07 '26 02:02

gruber


1 Answers

You could lay out your source code like so:

Main.hs
A/Module.hs

You need to specify in A/Module.hs which module it actually is; it has to be:

module A.Module where

...

In Main.hs, you import A.Module; all names are exported by default.

like image 143
solidsnack Avatar answered Feb 08 '26 15:02

solidsnack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!