I declared a class of types that admits a value:
class NonEmpty a where
example :: a
And also, I declared the complement class:
import Data.Void
class Empty a where
exampleless :: a -> Void
Demonstrating a function space is empty is easy:
instance (NonEmpty a, Empty b) => Empty (a -> b) where
exampleless f = exampleless (f example)
But what about its complement? Haskell doesn't let me have these instances simultaneously:
instance Empty a => NonEmpty (a -> b) where
example = absurd . exampleless
instance NonEmpty b => NonEmpty (a -> b) where
example _ = example
Is there any way to bypass this problem?