{-# language TypeFamilies, DataKinds, UndecidableSuperClasses, TypeFamilyDependencies, QuantifiedConstraints #-} module M where import GHC.TypeLits class Tensor r where type TensorOf (n :: Nat) r = t | t -> n r class c (TensorOf n r) => CTensorOf c n r where foo :: (forall n. CTensorOf RealFloat n r) => TensorOf n r -> TensorOf n r foo x = x