With the following sample module:
module Exp ( initial, myval ) where
data State = State { i :: Int }
initial = State { i = 123 }
myval st = i st
After I load the module in GHCI, I can see that the State
and i
names have also been exported. I can get their types and use them. How do I limit the export so that only initial
(a black box) and myval
are exported?
State
and i
are not exported, but if you load an interpreted module in ghci, then all top-level definitions of that module are in scope. To hide what you didn't export from ghci, compile the module and load the compiled module, :l Exp
resp ghci Exp
. Then only the exported entities are available.
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