Is there a general way to apply constraints to a type application?
问题 A comment by user 2426021684 led me to investigate whether it was possible to come up with a type function F such that F c1 c2 fa demonstrates that for some f and a : fa ~ f a c1 f c2 a It turns out that the simplest form of this is quite easy. However, I found it rather difficult to work out how to write a poly-kinded version. Fortunately, I managed to find a way as I was writing this question. 回答1: First, some boilerplate: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ConstraintKinds #-} {-#