I have an internal module that I would like to provide an external API for
module Positive.Internal where newtype Positive a = Positive { getPositive :: a } deriving (Eq, Ord) -- smart constructor toPositive :: (Num a, Ord a) => a -> Maybe (Positive a) toPositive a | a <= 0 = Nothing | otherwise = Just $ Positive a -- ...
I want to hide the mute constructor and replace it with a unidirectional template so that users can still match match values, they just need to use the smart designer to use the new values.
Since I want the template and the mute constructor to use the same name, I need to hide the mute constructor to prevent namespace conflicts.
However, since the mute constructor and type section names are, it is a little more difficult to import everything except the mute constructor.
I am currently doing this, which works fine:
{-
I could simplify imports simply by using qualified imports, but I'm curious.
Is there a way to import all Positive.Internal in one import statement, except for the silent constructor?
I tried hiding (Positive(Positive)) , but this hid both the type and the dumb constructor. I quoted a wiki , but I did not notice any way to distinguish between constructors and types in hiding lists.
module haskell
rampion
source share