O(n) Make a mutable copy of a Text.
Modulererebase-1.21.2Haskell2010
Data.Text.Foreign
- 1 type
- 12 values
- Packagererebase-1.21.2
- Exports13
- LanguageHaskell2010
- LicenceMIT
- SourceForeign.hs
O(1) Return the length of a Text in units of Word8. This
is useful for sizing a target array appropriately before using
unsafeCopyToPtr.
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.ForeignEnum I8Defined in text-2.1.3 · Data.Text.ForeignEq I8Defined in text-2.1.3 · Data.Text.ForeignIntegral I8Defined in text-2.1.3 · Data.Text.ForeignNum I8Defined in text-2.1.3 · Data.Text.ForeignOrd I8Defined in text-2.1.3 · Data.Text.ForeignRead I8Defined in text-2.1.3 · Data.Text.ForeignReal I8Defined in text-2.1.3 · Data.Text.ForeignShow I8Defined in text-2.1.3 · Data.Text.Foreign
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.
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.
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.
O(n) Perform an action on a temporary, mutable copy of a Text. The copy is freed as soon as the action returns.