{-# LANGUAGE AllowAmbiguousTypes #-} module Telescope.Data.KnownText where import Data.Proxy (Proxy (..)) import Data.Text import GHC.TypeLits -- | Types that have a textual representation, like 'KnownSymbol', but for any 'Type' class KnownText a where knownText :: Text instance (KnownSymbol s) => KnownText s where knownText :: Text knownText = String -> Text pack (String -> Text) -> String -> Text forall a b. (a -> b) -> a -> b $ forall (n :: Symbol) (proxy :: Symbol -> *). KnownSymbol n => proxy n -> String symbolVal @s Proxy s forall {k} (t :: k). Proxy t Proxy