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?
Stateandiare 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 Exprespghci Exp. Then only the exported entities are available.