Skip to content

Commit 353e758

Browse files
committed
Remove obsolete functions
This reduces the surface area of lib:Cabal by removing entry points that Setup.hs scripts are very unlikely to use.
1 parent 4a025e8 commit 353e758

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

Cabal/Distribution/Simple/Utils.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ module Distribution.Simple.Utils (
136136
rewriteFile,
137137

138138
-- * Unicode
139-
fromUTF8,
140139
fromUTF8BS,
141140
fromUTF8LBS,
142-
toUTF8,
143141
toUTF8BS,
144142
toUTF8LBS,
145143
readUTF8File,
@@ -148,8 +146,6 @@ module Distribution.Simple.Utils (
148146
normaliseLineEndings,
149147

150148
-- * BOM
151-
startsWithBOM,
152-
fileHasBOM,
153149
ignoreBOM,
154150

155151
-- * generic utils

Cabal/Distribution/Utils/Generic.hs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ module Distribution.Utils.Generic (
2929
-- * Unicode
3030

3131
-- ** Conversions
32-
fromUTF8,
3332
fromUTF8BS,
3433
fromUTF8LBS,
3534

36-
toUTF8,
3735
toUTF8BS,
3836
toUTF8LBS,
3937

@@ -43,8 +41,6 @@ module Distribution.Utils.Generic (
4341
writeUTF8File,
4442

4543
-- ** BOM
46-
startsWithBOM,
47-
fileHasBOM,
4844
ignoreBOM,
4945

5046
-- ** Misc
@@ -161,41 +157,18 @@ writeFileAtomic targetPath content = do
161157
-- * Unicode stuff
162158
-- ------------------------------------------------------------
163159

164-
-- This is a modification of the UTF8 code from gtk2hs and the
165-
-- utf8-string package.
166-
167-
{-# DEPRECATED fromUTF8 "Please use 'decodeStringUtf8', 'fromUTF8BS', or 'fromUTF8BS'" #-}
168-
fromUTF8 :: String -> String
169-
fromUTF8 = decodeStringUtf8 . map c2w
170-
where
171-
c2w c | c > '\xFF' = error "fromUTF8: invalid input data"
172-
| otherwise = fromIntegral (ord c)
173-
174160
fromUTF8BS :: SBS.ByteString -> String
175161
fromUTF8BS = decodeStringUtf8 . SBS.unpack
176162

177163
fromUTF8LBS :: BS.ByteString -> String
178164
fromUTF8LBS = decodeStringUtf8 . BS.unpack
179165

180-
{-# DEPRECATED toUTF8 "Please use 'encodeStringUtf8', 'toUTF8BS', or 'toUTF8BS'" #-}
181-
toUTF8 :: String -> String
182-
toUTF8 = map (chr . fromIntegral) . encodeStringUtf8
183-
184166
toUTF8BS :: String -> SBS.ByteString
185167
toUTF8BS = SBS.pack . encodeStringUtf8
186168

187169
toUTF8LBS :: String -> BS.ByteString
188170
toUTF8LBS = BS.pack . encodeStringUtf8
189171

190-
-- | Whether BOM is at the beginning of the input
191-
startsWithBOM :: String -> Bool
192-
startsWithBOM ('\xFEFF':_) = True
193-
startsWithBOM _ = False
194-
195-
-- | Check whether a file has Unicode byte order mark (BOM).
196-
fileHasBOM :: FilePath -> NoCallStackIO Bool
197-
fileHasBOM f = (startsWithBOM . fromUTF8LBS) <$> BS.readFile f
198-
199172
-- | Ignore a Unicode byte order mark (BOM) at the beginning of the input
200173
--
201174
ignoreBOM :: String -> String

0 commit comments

Comments
 (0)