Merge remote-tracking branch 'origin/pending' into coerceToString-returns-nix-string

This commit is contained in:
Doug Beardsley 2018-11-17 16:15:06 -05:00
commit cda7345647
2 changed files with 7 additions and 4 deletions

View file

@ -320,7 +320,7 @@ assembleString = \case
Indented _ parts -> fromParts parts
DoubleQuoted parts -> fromParts parts
where
fromParts = fmap (fmap hackyStringMConcat . sequence) . traverse go
fromParts = fmap (fmap principledStringMConcat . sequence) . traverse go
go = runAntiquoted "\n" (pure . Just . hackyMakeNixStringWithoutContext) (>>= fromValueMay)

View file

@ -15,8 +15,7 @@ module Nix.String (
, principledMakeNixStringWithSingletonContext
, hackyModifyNixContents
, principledStringMappend
, hackyStringMappend
, hackyStringMConcat
, principledStringMConcat
) where
import qualified Data.HashSet as S
@ -26,7 +25,7 @@ import qualified Data.Text as Text
import GHC.Generics
import Data.Semigroup
-- {-# WARNING hackyStringMappend, hackyStringMConcat, hackyStringIgnoreContextMaybe, hackyStringIgnoreContext, hackyMakeNixStringWithoutContext, hackyModifyNixContents "This NixString function needs to be replaced" #-}
-- {-# WARNING hackyStringIgnoreContextMaybe, hackyStringIgnoreContext, hackyMakeNixStringWithoutContext, hackyModifyNixContents "This NixString function needs to be replaced" #-}
-- | A 'ContextFlavor' describes the sum of possible derivations for string contexts
data ContextFlavor =
@ -76,6 +75,10 @@ principledIntercalateNixString sep nss = NixString contents ctx
hackyStringMConcat :: [NixString] -> NixString
hackyStringMConcat = foldr hackyStringMappend (NixString mempty mempty)
-- | Combine NixStrings using mconcat
principledStringMConcat :: [NixString] -> NixString
principledStringMConcat = foldr principledStringMappend (NixString mempty mempty)
--instance Semigroup NixString where
--NixString s1 t1 <> NixString s2 t2 = NixString (s1 <> s2) (t1 <> t2)