I have an issue, that is morally similar to this:
import Data.Proxy (Proxy)
import Data.Kind (Type)
-- law: \a -> poly a (root a) ≡ 0
class C (a :: Type) where
poly :: Proxy a -> Double -> Double
poly _ x = 2 * x + 5
root :: Proxy a -> Double
root _ = -2.5
{-# MINIMAL poly, root | () #-}
data A
instance C A where
poly _ x = x + 5
-- gives warning correctly because of missing `root`
-- root _ = -5
data B
--- shouldn't give warning
instance C B
Using the default methods should only be possible if all of them are defaulted.
Otherwise it should give a warning.
How can I do this? The MINIMAL
pragma doesn’t do what I want.