Let's say I have a polymorphic type, where one of the parameters is a higher type ( * -> * ).
data Tricky m = Tricky { numbers :: m Int, genesis :: m String }
Is there a general way to get instances for these types without using secret and unsafe language extensions?
I tried turning on StandaloneDeriving so that I could specify the context:
deriving instance Show (m Int) => Show (Tricky m)
But the GHC then complains that the restriction is no less than the head of the instance, and points me toward UndecidableInstances .
Summarizing:
1. Should I just accept this advice or is there a better way?
2. Are there any suggestions to facilitate this process?
3. Is it somehow not good to want to output βhigherβ copies? It would be better to derive instances for several specific types (for example, Vector , [] , Set )
source share