module Text.Show.Text.Data.Array (showbArrayPrec) where
import Data.Array (Array, assocs, bounds)
import Data.Ix (Ix)
import Data.Text.Lazy.Builder (Builder)
import GHC.Show (appPrec)
import Prelude hiding (Show)
import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)
import Text.Show.Text.Data.List ()
import Text.Show.Text.Data.Tuple ()
import Text.Show.Text.Utils ((<>))
#include "inline.h"
showbArrayPrec :: (Show i, Show e, Ix i) => Int -> Array i e -> Builder
showbArrayPrec p a = showbParen (p > appPrec) $
"array "
<> showb (bounds a)
<> showbSpace
<> showb (assocs a)
instance (Show i, Show e, Ix i) => Show (Array i e) where
showbPrec = showbArrayPrec
INLINE_INST_FUN(showbPrec)