Re: dumping ByteArray#

Viktor Dukhovni <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
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.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.