HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleos-string-2.0.8Haskell2010

System.OsString.Data.ByteString.Short.Internal

Internal low-level utilities mostly for System.OsPath.Data.ByteString.Short.Word16, such as byte-array operations and other stuff not meant to be exported from Word16 module.

  • 2 types
  • 38 values
  • Packageos-string-2.0.8
  • Exports40
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs

O(n). Construct a new ShortByteString from a CWString. The resulting ShortByteString is an immutable copy of the original CWString, and is managed on the Haskell heap. The original CWString must be null terminated.

O(n). Construct a new ShortByteString from a CWStringLen. The resulting ShortByteString is an immutable copy of the original CWStringLen. The ShortByteString is a normal Haskell value and will be managed on the Haskell heap.

valueuseAsCWString :: ShortByteString -> (Ptr Word16 -> IO a) -> IO a
#

O(n) construction. Use a ShortByteString with a function requiring a null-terminated CWString. The CWString is a copy and will be freed automatically; it must not be stored or used after the subcomputation finishes.

valueuseAsCWStringLen :: ShortByteString -> ((Ptr Word16, Int) -> IO a) -> IO a
#

O(n) construction. Use a ShortByteString with a function requiring a CWStringLen. As for useAsCWString this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.

O(n) construction. Use a ShortByteString with a function requiring a CWStringLen. As for useAsCWString this function makes a copy of the original ShortByteString. It must not be stored or used after the subcomputation finishes.

valuecreateAndTrim
  1. :: Int
  2. -> forall s. MBA s -> ST s (Int, a)
  3. -> (ShortByteString, a)
#

Given the maximum size needed and a function to make the contents of a ShortByteString, createAndTrim makes the ShortByteString. The generating function is required to return the actual final size (<= the maximum size) and the result value. The resulting byte array is realloced to this size.