module Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple) where
#if !(MIN_VERSION_base(4,8,0))
import Data.Monoid (mempty)
#endif
import Data.Text.Lazy.Builder (Builder)
import Prelude hiding (Show)
import Text.Show.Text.Classes (Show(showbPrec))
import Text.Show.Text.Utils ((<>), s)
showbArgs :: Show a => Builder -> [a] -> Builder
showbArgs _ [] = mempty
showbArgs _ [a] = showbPrec 10 a
showbArgs sep (a:as) = showbPrec 10 a <> sep <> showbArgs sep as
showbTuple :: Show a => [a] -> Builder
showbTuple args = s '(' <> showbArgs (s ',') args <> s ')'