[Haskell-cafe] dumping ByteArray#
Viktor Dukhovni
ietf-dane at dukhovni.org
Sat Mar 29 02:38:18 UTC 2025
On Sat, Mar 29, 2025 at 11:25:17AM +0900, Kazu Yamamoto (山本和彦) via Haskell-Cafe wrote:
> For debugging, I need to dump the inside of `ByteArray#`.
> Are there any utility functions for this purpose?
The `SBS` pattern in `Data.ByteString.Short.Internal` wraps up
a `ByteArray#` as `ShortByteString`.
$ ghci
GHCi, version 9.8.1: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/viktor/.ghc/ghci.conf
λ> import Data.ByteString.Short.Internal
λ> :info SBS
pattern SBS :: GHC.Prim.ByteArray# -> ShortByteString
-- Defined in ‘Data.ByteString.Short.Internal’
λ>
What sort of "dump" did you have in mind? A hexadecimal encoding?
Something else?
--
Viktor.
More information about the Haskell-Cafe
mailing list