HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulerebase-1.21.2Haskell2010

Rebase.Data.Text.Foreign

  • 1 type
  • 12 values
  • Packagerebase-1.21.2
  • Exports13
  • LanguageHaskell2010
  • LicenceMIT
  • SourceForeign.hs
valuewithCString :: Text -> (CString -> IO a) -> IO a
#

Marshal a Text into a C string with a trailing NUL byte, encoded as UTF-8 in temporary storage.

The Text itself must not contain any NUL bytes, this precondition is not checked. Cf. withCStringLen.

The temporary storage is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this function returns.

valuelengthWord8 :: Text -> Int
#

O(1) Return the length of a Text in units of Word8. This is useful for sizing a target array appropriately before using unsafeCopyToPtr.

newtypenewtype I8
#

A type representing a number of UTF-8 code units.

Instances9Bounded, Enum, Eq, Integral, Num, Ord, …
  • Bounded I8Defined in text-2.1.3 · Data.Text.Foreign
  • Enum I8Defined in text-2.1.3 · Data.Text.Foreign
  • Eq I8Defined in text-2.1.3 · Data.Text.Foreign
  • Integral I8Defined in text-2.1.3 · Data.Text.Foreign
  • Num I8Defined in text-2.1.3 · Data.Text.Foreign
  • Ord I8Defined in text-2.1.3 · Data.Text.Foreign
  • Read I8Defined in text-2.1.3 · Data.Text.Foreign
  • Real I8Defined in text-2.1.3 · Data.Text.Foreign
  • Show I8Defined in text-2.1.3 · Data.Text.Foreign
valuedropWord8 :: I8 -> Text -> Text
#

O(1) Return the suffix of the Text, with n Word8 units dropped from its beginning.

If n would cause the Text to begin inside a code point, the beginning of the suffix will be advanced by several additional Word8 unit to maintain its validity.

valuepeekCString :: CString -> IO Text
#

O(n) Decode a null-terminated C string, which is assumed to have been encoded as UTF-8. If decoding fails, a UnicodeException is thrown.

O(n) Decode a C string with explicit length, which is assumed to have been encoded as UTF-8. If decoding fails, a UnicodeException is thrown.

valuetakeWord8 :: I8 -> Text -> Text
#

O(1) Return the prefix of the Text of n Word8 units in length.

If n would cause the Text to end inside a code point, the end of the prefix will be advanced by several additional Word8 units to maintain its validity.

valueuseAsPtr :: Text -> (Ptr Word8 -> I8 -> IO a) -> IO a
#

O(n) Perform an action on a temporary, mutable copy of a Text. The copy is freed as soon as the action returns.

valuewithCStringLen :: Text -> (CStringLen -> IO a) -> IO a
#

Marshal a Text into a C string encoded as UTF-8 in temporary storage, with explicit length information. The encoded string may contain NUL bytes, and is not followed by a trailing NUL byte.

The temporary storage is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this function returns.