-- PrettyUtils.hs: prettyprinter helpers
-- Copyright © 2018-2022  Clint Adams
-- This software is released under the terms of the Expat license.
-- (See the LICENSE file).
module Codec.Encryption.OpenPGP.Types.Internal.PrettyUtils where

import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import Data.Text.Encoding (decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import Prettyprinter (Doc, Pretty(..))

prettyBS :: B.ByteString -> Doc ann
prettyBS = pretty . decodeUtf8With lenientDecode

prettyLBS :: BL.ByteString -> Doc ann
prettyLBS = pretty . decodeUtf8With lenientDecode . BL.toStrict
