It sounds trivial but I can't find out what is supposed to do.
following is my type definition:
data CDeq q a = Shallow (q a)
| Deep{ hq ⦂ q a
, susp ⦂ CDeq q (q a)
, tq ⦂ q a }
and I want it to have an instance of Show
.
since GHC doesn't allow me to deriving
here, I just try to write myself one:
instance (Show a, Show ????) => Show (CDeq q a) where
....
but I got stuck.
I don't know how to represent that for all type v, (q v) can be shown
in haskell.
I can't just do following simply:
instance (Show a, Show (q a)) => Show (CDeq q a) where
....
since to show CDeq q (q a)
, Show (q (q a))
is required, then Show (q (q (q a)))
is required, then on and on.
So I am wondering is there a syntax such that I can express the meaning I stated up there?
I once thought forall
could be the solution to this, but it doesn't work:
instance (Show a, forall v. Show (q v)) => Show (CDeq q a)