summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-02 20:42:34 -0400
committerBen Gamari <ben@smart-cactus.org>2022-11-02 21:38:59 -0400
commit8f8dba0190fe2a3a8b148fecf0dc83a725fb3fd2 (patch)
treef84312ef70641303c3c4f1a480a3735f2129840d
parentf4200e2219606e73d051f0e2de98cf75d72bd683 (diff)
downloadhaskell-8f8dba0190fe2a3a8b148fecf0dc83a725fb3fd2.tar.gz
Revert "base: Move CString, CStringLen to GHC.Foreign"ghc-9.4.3-release
This reverts commit 5ec22f0135483ea8a8a543c53dcc7f9d7f6a8dea.
-rw-r--r--libraries/base/Foreign/C/String.hs11
-rw-r--r--libraries/base/GHC/Foreign.hs6
2 files changed, 11 insertions, 6 deletions
diff --git a/libraries/base/Foreign/C/String.hs b/libraries/base/Foreign/C/String.hs
index 2b0c7ec250..a8eb60c5a3 100644
--- a/libraries/base/Foreign/C/String.hs
+++ b/libraries/base/Foreign/C/String.hs
@@ -110,11 +110,20 @@ import GHC.Base
import {-# SOURCE #-} GHC.IO.Encoding
import qualified GHC.Foreign as GHC
-import GHC.Foreign (CString, CStringLen)
-----------------------------------------------------------------------------
-- Strings
+-- representation of strings in C
+-- ------------------------------
+
+-- | 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
-- ------------------
--
diff --git a/libraries/base/GHC/Foreign.hs b/libraries/base/GHC/Foreign.hs
index 0bd858190a..042745ce11 100644
--- a/libraries/base/GHC/Foreign.hs
+++ b/libraries/base/GHC/Foreign.hs
@@ -19,7 +19,6 @@
module GHC.Foreign (
-- * C strings with a configurable encoding
- CString, CStringLen,
-- conversion of C strings into Haskell strings
--
@@ -75,11 +74,8 @@ putDebugMsg | c_DEBUG_DUMP = debugLn
| otherwise = const (return ())
--- | A C string is a reference to an array of C characters terminated by NUL.
+-- These definitions are identical to those in Foreign.C.String, but copied in here to avoid a cycle:
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