[Git][ghc/ghc][ghc-9.4] Revert "base: Move CString, CStringLen to GHC.Foreign"

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Nov 3 01:39:07 UTC 2022



Ben Gamari pushed to branch ghc-9.4 at Glasgow Haskell Compiler / GHC


Commits:
8f8dba01 by Ben Gamari at 2022-11-02T21:38:59-04:00
Revert "base: Move CString, CStringLen to GHC.Foreign"

This reverts commit 5ec22f0135483ea8a8a543c53dcc7f9d7f6a8dea.

- - - - -


2 changed files:

- libraries/base/Foreign/C/String.hs
- libraries/base/GHC/Foreign.hs


Changes:

=====================================
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
 -- ------------------
 --


=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f8dba0190fe2a3a8b148fecf0dc83a725fb3fd2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f8dba0190fe2a3a8b148fecf0dc83a725fb3fd2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221102/c20eeb08/attachment-0001.html>


More information about the ghc-commits mailing list