Haskell modules: hidden names and ghci

I am trying to export only a subset of the names from the Haskell module, but ghci gladly allows me to access even hidden names.

module Hiding (shown, calc) where

calc = shown * hidden

shown :: Int
shown = 3

hidden :: Int
hidden = 2

But when trying this in ghci I get:

Prelude> :l Hiding.hs 
[1 of 1] Compiling Hiding           ( Hiding.hs, interpreted )
Ok, modules loaded: Hiding.
*Hiding> hidden
2

What am I doing wrong?

(Edit: what is it worth, I am using ghci 6.12.3 on Arch Linux)

+3
source share
2 answers

It seems that GHCi is loading your module so that you check it, that is, introduce you to the module volume. Two hints of this are the invitation *Hiding>and the fact that you turned to a hidden function.

Edit:
: http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#id3045728

+5

, . , , hidden . , GHCI :)

0

Source: https://habr.com/ru/post/1779398/


All Articles