diff --git a/libraries/base/Foreign/C/String.hs b/libraries/base/Foreign/C/String.hs index 2b0c7ec25029f84c10c2fc62b47a0cd6798c5848..a8eb60c5a31ebabddaa6e02ad7ab424d0961d2d5 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 0bd858190a8a603447bebc7ab642c832d27681db..042745ce1108b4d337ccb93a7b01141fd3d5cd09 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