{-# OPTIONS_GHC -Wno-orphans #-}
{-|
Module:      TextShow.Data.Vector.NonEmpty
Copyright:   (C) 2023 Ryan Scott
License:     BSD-style (see the file LICENSE)
Maintainer:  Ryan Scott
Stability:   Provisional
Portability: GHC

'TextShow' instances for the @NonEmptyVector@ type.
-}
module TextShow.Data.Vector.NonEmpty () where

import qualified Data.Vector.NonEmpty as B (NonEmptyVector, toVector)

import           TextShow (TextShow(..), TextShow1(..), showbPrec1)
import           TextShow.Data.Vector ()

instance TextShow a => TextShow (B.NonEmptyVector a) where
    showbPrec :: Int -> NonEmptyVector a -> Builder
showbPrec = forall (f :: * -> *) a.
(TextShow1 f, TextShow a) =>
Int -> f a -> Builder
showbPrec1
    {-# INLINE showbPrec #-}

instance TextShow1 B.NonEmptyVector where
    liftShowbPrec :: forall a.
(Int -> a -> Builder)
-> ([a] -> Builder) -> Int -> NonEmptyVector a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl Int
p = forall (f :: * -> *) a.
TextShow1 f =>
(Int -> a -> Builder) -> ([a] -> Builder) -> Int -> f a -> Builder
liftShowbPrec Int -> a -> Builder
sp [a] -> Builder
sl Int
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. NonEmptyVector a -> Vector a
B.toVector
    {-# INLINE liftShowbPrec #-}