module Text.Show.Text.Data.Binary (showbDecoderWith) where
import Data.Binary.Get.Internal (Decoder(..))
import Data.Monoid.Compat
import Prelude hiding (Show)
import Text.Show.Text (Show(..), Show1(..), Builder,
fromString, showbPrec1)
#include "inline.h"
showbDecoderWith :: (a -> Builder) -> Decoder a -> Builder
showbDecoderWith _ (Fail _ msg) = "Fail: " <> fromString msg
showbDecoderWith _ (Partial _) = "Partial _"
showbDecoderWith sp (Done _ a) = "Done: " <> sp a
showbDecoderWith _ (BytesRead _ _) = "BytesRead"
instance Show a => Show (Decoder a) where
showbPrec = showbPrec1
INLINE_INST_FUN(showbPrec)
instance Show1 Decoder where
showbPrecWith sp _ = showbDecoderWith $ sp 0
INLINE_INST_FUN(showbPrecWith)