@@ -53,11 +53,20 @@ instance
5353class HasTypesDeep a s where
5454 typesDeep :: Traversal' s a
5555
56+class Or a b where
57+ foldOr :: Applicative g => (a -> g a) -> b -> g b
58+
59+instance Or a a where
60+ foldOr f a = f a
61+
62+instance {-# OVERLAPPABLE #-} Or a b where
63+ foldOr _ = pure
64+
5665instance
57− ( HasConstraints' ((~) a) s
66+ ( HasConstraints' (Or a) s
5867 ) => HasTypesDeep a s where
5968
60− typesDeep f s = constraints' @((~) a) f s
69+ typesDeep f s = constraints' @(Or a) (foldOr f) s
6170
6271--------------------------------------------------------------------------------
6372type family Primitive a :: Bool where