Skip to content

Commit 208106d

Browse files
committed
Nix/String: form "Deprecated API" to gather hacky* functions
1 parent fb3786e commit 208106d

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/Nix/String.hs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ import Data.Text ( Text )
4747
import qualified Data.Text as Text
4848
import GHC.Generics
4949

50-
-- {-# WARNING hackyGetStringNoContext, hackyStringIgnoreContext, hackyMakeNixStringWithoutContext "This NixString function needs to be replaced" #-}
51-
5250
-- | A 'ContextFlavor' describes the sum of possible derivations for string contexts
5351
data ContextFlavor =
5452
DirectPath
@@ -132,13 +130,6 @@ principledStringMappend :: NixString -> NixString -> NixString
132130
principledStringMappend (NixString s1 t1) (NixString s2 t2) =
133131
NixString (s1 <> s2) (t1 <> t2)
134132

135-
-- 2021-01-02: NOTE: This function is ERRADICATED from the source code.
136-
-- ERRADICATE it from the API.
137-
-- | Combine two NixStrings using mappend
138-
hackyStringMappend :: NixString -> NixString -> NixString
139-
hackyStringMappend (NixString s1 t1) (NixString s2 t2) =
140-
NixString (s1 <> s2) (t1 <> t2)
141-
142133
-- | Combine NixStrings with a separator
143134
principledIntercalateNixString :: NixString -> [NixString] -> NixString
144135
principledIntercalateNixString _ [] = principledMempty
@@ -148,12 +139,6 @@ principledIntercalateNixString sep nss = NixString contents ctx
148139
contents = Text.intercalate (nsContents sep) (map nsContents nss)
149140
ctx = S.unions (nsContext sep : map nsContext nss)
150141

151-
-- 2021-01-02: NOTE: This function is ERRADICATED from the source code.
152-
-- ERRADICATE it from the API.
153-
-- | Combine NixStrings using mconcat
154-
hackyStringMConcat :: [NixString] -> NixString
155-
hackyStringMConcat = foldr principledStringMappend (NixString mempty mempty)
156-
157142
-- | Empty string with empty context.
158143
principledStringMempty :: NixString
159144
principledStringMempty = NixString mempty mempty
@@ -250,3 +235,20 @@ runWithStringContext = runIdentity . runWithStringContextT
250235
-- Warning: this may be unsafe, depending on how you handle the resulting context list.
251236
runWithStringContext' :: WithStringContextT Identity a -> (a, S.HashSet StringContext)
252237
runWithStringContext' = runIdentity . runWithStringContextT'
238+
239+
-- * Deprecated API
240+
241+
-- {-# WARNING hackyGetStringNoContext, hackyStringIgnoreContext, hackyMakeNixStringWithoutContext "This NixString function needs to be replaced" #-}
242+
243+
-- NOTE: These functions are ERRADICATED from the source code.
244+
-- ERRADICATE them from the API.
245+
246+
-- | Combine two NixStrings using mappend
247+
hackyStringMappend :: NixString -> NixString -> NixString
248+
hackyStringMappend (NixString s1 t1) (NixString s2 t2) =
249+
NixString (s1 <> s2) (t1 <> t2)
250+
251+
-- | Combine NixStrings using mconcat
252+
hackyStringMConcat :: [NixString] -> NixString
253+
hackyStringMConcat = foldr principledStringMappend (NixString mempty mempty)
254+

0 commit comments

Comments
 (0)