summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Foreign.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-08-17 13:07:31 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-11 23:45:10 -0400
commit69ccec2ce685fee3aeac66519645d568b169b592 (patch)
tree8997344b3b9644cd0c0a4165a7489cb15d6a1bf5 /libraries/base/GHC/Foreign.hs
parentf6260e8b94ef531204351b79e0ca3ff8921d1b2f (diff)
downloadhaskell-69ccec2ce685fee3aeac66519645d568b169b592.tar.gz
base: Move CString, CStringLen to GHC.Foreign
Diffstat (limited to 'libraries/base/GHC/Foreign.hs')
-rw-r--r--libraries/base/GHC/Foreign.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/libraries/base/GHC/Foreign.hs b/libraries/base/GHC/Foreign.hs
index 4792c1b33e..78ffa11bee 100644
--- a/libraries/base/GHC/Foreign.hs
+++ b/libraries/base/GHC/Foreign.hs
@@ -19,6 +19,7 @@
module GHC.Foreign (
-- * C strings with a configurable encoding
+ CString, CStringLen,
-- conversion of C strings into Haskell strings
--
@@ -74,8 +75,11 @@ putDebugMsg | c_DEBUG_DUMP = debugLn
| otherwise = const (return ())
--- These definitions are identical to those in Foreign.C.String, but copied in here to avoid a cycle:
+-- | A C string is a reference to an array of C characters terminated by NUL.
type CString = Ptr CChar
+
+-- | A string with explicit length information in bytes instead of a
+-- terminating NUL (allowing NUL characters in the middle of the string).
type CStringLen = (Ptr CChar, Int)
-- exported functions