[Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

Brandon Moore brandon_m_moore at yahoo.com
Fri Mar 11 15:03:37 CET 2011


It is a goal of the ByteString library that you should almost never need to work
directly with the PS constructor and the things used in that definition. If you 
find
some task involving IO or string manipulation that seems to require using the
internal operations, it's probably worth bringing it up on the list. That said,
it's always good to know how things work, and the internals may be relevant if 
you
want to make an interface to a foreign library use ByteStrings.

Look at the Foreign.* modules to see how to work with Ptr values, especially
Foreign.ForeignPtr, Foreign.Ptr, Foreign.Marshal:

http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.3.1.0/Foreign-ForeignPtr.html

http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.3.1.0/Foreign-Ptr.html

http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.3.1.0/Foreign-Marshal.html


The GHC manual has a little bit on unboxed types like Int#

http://www.haskell.org/ghc/docs/latest/html/users_guide/primitives.html

GHC.Prim provides the basic operations

http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/GHC-Prim.html


There is also the original paper (from Simon Peyton-Jones' page)

http://research.microsoft.com/en-us/um/people/simonpj/papers/unboxed-values.ps.Z

Brandon



      



More information about the Haskell-Cafe mailing list