module TextShow.Data.Binary () where
import Data.Binary.Get.Internal (Decoder(..))
import Data.Monoid.Compat
import TextShow (TextShow(..), TextShow1(..), Builder, fromString, showbPrec1)
instance TextShow a => TextShow (Decoder a) where
showbPrec = showbPrec1
instance TextShow1 Decoder where
liftShowbPrec sp' _ _ = go $ sp' 0
where
go :: (a -> Builder) -> Decoder a -> Builder
go _ (Fail _ msg) = "Fail: " <> fromString msg
go _ (Partial _) = "Partial _"
go sp (Done _ a) = "Done: " <> sp a
go _ (BytesRead _ _) = "BytesRead"