Suppose we have a constructor of type f that accepts two types using the pair created by DataKinds.
forall (f :: (ka, kb) -> *)
Then I can implement a function forwardthat is similar to curryfor a quantifier forall:
forward :: forall (f :: (ka, kb) -> *).
(forall (ab :: (ka, kb)). f ab) ->
(forall (a :: ka) (b :: kb). f '(a, b))
forward x = x
However, the inverse function is problematic:
backward :: forall (f :: (*, *) -> *).
(forall (a :: *) (b :: *). f '(a, b)) ->
(forall (ab :: (*, *)). f ab)
backward x = x
GHC 8.0.1 contains an error message:
• Couldn't match type 'ab' with '' (a0, b0) '
'ab' is a rigid type variable bound by
the type signature for:
backward :: forall (ab :: (*, *)). (forall a b. f '(a, b)) -> f ab
at: 6: 116
Expected type: f ab
Actual type: f '(a0, b0)
• In the expression: x
In an equation for 'backward': backward x = x
. ? GHC?