I'm facing the following problem: I have multiple instances of a type class defined in a module but don't want to export all of them. How can I do that?
module SomeModule ( calculate ) where class Something a where calculate :: a -> Int instance Something Double where calculate x = calculate $ roundToInt x instance Something Int where calculate x = doSomething x roundToInt :: Double -> Int roundToInt = round doSomething :: Int -> Int doSomething _ = 42
In this (simplified) example I have two instances of the type class
Something which depend on each other, but I just would like to export the instance for
Doubles and not for
Ints. But in my example, both instances get exported implicitly. Is there a way around it?