module TextShow.Data.Typeable.Utils (showbArgs, showbTuple) where
import Data.Text.Lazy.Builder (Builder, singleton)
import Prelude ()
import Prelude.Compat
import TextShow.Classes (TextShow(..))
showbArgs :: TextShow a => Builder -> [a] -> Builder
showbArgs :: Builder -> [a] -> Builder
showbArgs Builder
_ [] = Builder
forall a. Monoid a => a
mempty
showbArgs Builder
_ [a
a] = Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec Int
10 a
a
showbArgs Builder
sep (a
a:[a]
as) = Int -> a -> Builder
forall a. TextShow a => Int -> a -> Builder
showbPrec Int
10 a
a Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
sep Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> [a] -> Builder
forall a. TextShow a => Builder -> [a] -> Builder
showbArgs Builder
sep [a]
as
showbTuple :: TextShow a => [a] -> Builder
showbTuple :: [a] -> Builder
showbTuple [a]
args = Char -> Builder
singleton Char
'(' Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> [a] -> Builder
forall a. TextShow a => Builder -> [a] -> Builder
showbArgs (Char -> Builder
singleton Char
',') [a]
args Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
singleton Char
')'
{-# INLINE showbTuple #-}