
On 12 Jul 2021, at 4:24 pm, Viktor Dukhovni
wrote: However, it is possible to get something along those lines with a closed type family and an explicit list of verboten types:
Somewhat cleaner (no complaints from -Wall, and the Filtered type family now returns a constraint): {-# LANGUAGE ConstraintKinds , DataKinds , FlexibleContexts , TypeFamilies , TypeOperators , UndecidableInstances #-} import GHC.TypeLits (ErrorMessage(..), TypeError) import Data.Kind (Constraint) type family Filtered a :: Constraint where Filtered Int = TypeError ('ShowType Int ':<>: 'Text "s not welcome here") Filtered a = () foo :: (Show a, Filtered a) => a -> String foo = show -- Viktor.