module TextShow.Data.Vector (
showbVectorPrec
, showbVectorPrecWith
, showbVectorGenericPrec
, showbVectorGenericPrecWith
, showbVectorPrimitivePrec
, showbVectorStorablePrec
, showbVectorUnboxedPrec
, showbSizePrec
) where
import qualified Data.Vector as B (Vector)
import Data.Vector.Fusion.Stream.Size (Size)
import qualified Data.Vector.Generic as G (Vector)
import Data.Vector.Generic (toList)
import qualified Data.Vector.Primitive as P (Vector)
import Data.Vector.Primitive (Prim)
import qualified Data.Vector.Storable as S (Vector)
import qualified Data.Vector.Unboxed as U (Vector)
import Data.Vector.Unboxed (Unbox)
import Foreign.Storable (Storable)
import TextShow (TextShow(showbPrec), TextShow1(..), Builder)
import TextShow.TH (deriveTextShow)
import TextShow.Utils (showbUnaryList, showbUnaryListWith)
#include "inline.h"
showbVectorPrec :: TextShow a => Int -> B.Vector a -> Builder
showbVectorPrec = showbVectorGenericPrec
showbVectorPrecWith :: (a -> Builder) -> Int -> B.Vector a -> Builder
showbVectorPrecWith = showbVectorGenericPrecWith
showbVectorGenericPrec :: (G.Vector v a, TextShow a) => Int -> v a -> Builder
showbVectorGenericPrec p = showbUnaryList p . toList
showbVectorGenericPrecWith :: G.Vector v a => (a -> Builder) -> Int -> v a -> Builder
showbVectorGenericPrecWith sp p = showbUnaryListWith sp p . toList
showbVectorPrimitivePrec :: (TextShow a, Prim a) => Int -> P.Vector a -> Builder
showbVectorPrimitivePrec = showbVectorGenericPrec
showbVectorStorablePrec :: (TextShow a, Storable a) => Int -> S.Vector a -> Builder
showbVectorStorablePrec = showbVectorGenericPrec
showbVectorUnboxedPrec :: (TextShow a, Unbox a) => Int -> U.Vector a -> Builder
showbVectorUnboxedPrec = showbVectorGenericPrec
showbSizePrec :: Int -> Size -> Builder
showbSizePrec = showbPrec
instance TextShow a => TextShow (B.Vector a) where
showbPrec = showbVectorPrec
INLINE_INST_FUN(showbPrec)
instance TextShow1 B.Vector where
showbPrecWith sp = showbVectorPrecWith $ sp 0
INLINE_INST_FUN(showbPrecWith)
instance (TextShow a, Prim a) => TextShow (P.Vector a) where
showbPrec = showbVectorPrimitivePrec
INLINE_INST_FUN(showbPrec)
instance (TextShow a, Storable a) => TextShow (S.Vector a) where
showbPrec = showbVectorStorablePrec
INLINE_INST_FUN(showbPrec)
instance (TextShow a, Unbox a) => TextShow (U.Vector a) where
showbPrec = showbVectorUnboxedPrec
INLINE_INST_FUN(showbPrec)
$(deriveTextShow ''Size)