module Control.Eff.Concurrent.Misc
( showSTypeRepPrec
, showSTypeRep
, showSTypeable
, showSPrecTypeable
)
where
import Data.Dynamic
import Data.Typeable ()
import Type.Reflection
showSTypeable :: forall message . Typeable message => ShowS
showSTypeable = showSTypeRep (SomeTypeRep (typeRep @message))
showSPrecTypeable :: forall message . Typeable message => Int -> ShowS
showSPrecTypeable d = showSTypeRepPrec d (SomeTypeRep (typeRep @message))
showSTypeRep :: SomeTypeRep -> ShowS
showSTypeRep = showSTypeRepPrec 0
showSTypeRepPrec :: Int -> SomeTypeRep -> ShowS
showSTypeRepPrec _d (SomeTypeRep tr) =
let
(con, conArgs) = splitApps tr
renderArgs =
foldr1 (\f acc -> showString ", " . f . acc)
(showSTypeRepPrec 10 <$> conArgs)
in showString (tyConName con) .
if not (null conArgs) then
showChar '<'
. renderArgs
. showChar '>'
else id