Refer to https://wiki.haskell.org/Smart_constructors and module code:
module Resistor (
Resistor, -- abstract, hiding constructors
metalResistor, -- only way to build a metal resistor
) where
...
When I try this in ghci, I am able to call both metalResistor
and Metal
. Metal was supposed to be hidden.
What should I do to properly hide the Resistor
value constructor?