From 4631d1ab56bc60932ddba4cee71906564d68b8a2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Mar 2021 12:11:50 -0400 Subject: [PATCH] Fix build with attoparsec-0.14 It changed parseOnly in the ByteString.Lazy module to take a lazy, not strict ByteString. In all these cases though, we actually had a strict ByteString, so the most efficient fix, which also happens to avoid needing ifdefs, is to use the non-lazy module instead. This commit was sponsored by Denis Dzyubenko on Patreon. --- CHANGELOG | 1 + Logs/ContentIdentifier/Pure.hs | 2 +- Logs/Line.hs | 2 +- Logs/MapLog.hs | 7 ++++--- Logs/Remote/Pure.hs | 2 +- Logs/Trust/Pure.hs | 2 +- Logs/UUIDBased.hs | 7 ++++--- 7 files changed, 13 insertions(+), 10 deletions(-) Index: git-annex-8.20210310/Logs/ContentIdentifier/Pure.hs =================================================================== --- git-annex-8.20210310.orig/Logs/ContentIdentifier/Pure.hs +++ git-annex-8.20210310/Logs/ContentIdentifier/Pure.hs @@ -17,7 +17,7 @@ import Utility.Base64 import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as L -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A import qualified Data.Attoparsec.ByteString.Char8 as A8 import Data.ByteString.Builder import Data.List.NonEmpty (NonEmpty(..)) Index: git-annex-8.20210310/Logs/Line.hs =================================================================== --- git-annex-8.20210310.orig/Logs/Line.hs +++ git-annex-8.20210310/Logs/Line.hs @@ -9,7 +9,7 @@ module Logs.Line where import Common -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A import Data.Attoparsec.ByteString.Char8 (isEndOfLine) import qualified Data.DList as D Index: git-annex-8.20210310/Logs/MapLog.hs =================================================================== --- git-annex-8.20210310.orig/Logs/MapLog.hs +++ git-annex-8.20210310/Logs/MapLog.hs @@ -24,7 +24,8 @@ import Utility.QuickCheck import qualified Data.ByteString.Lazy as L import qualified Data.Map.Strict as M -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A +import qualified Data.Attoparsec.ByteString.Lazy as AL import qualified Data.Attoparsec.ByteString.Char8 as A8 import Data.ByteString.Builder @@ -49,8 +50,8 @@ buildMapLog fieldbuilder valuebuilder = nl = charUtf8 '\n' parseMapLog :: Ord f => A.Parser f -> A.Parser v -> L.ByteString -> MapLog f v -parseMapLog fieldparser valueparser = fromMaybe M.empty . A.maybeResult - . A.parse (mapLogParser fieldparser valueparser) +parseMapLog fieldparser valueparser = fromMaybe M.empty . AL.maybeResult + . AL.parse (mapLogParser fieldparser valueparser) mapLogParser :: Ord f => A.Parser f -> A.Parser v -> A.Parser (MapLog f v) mapLogParser fieldparser valueparser = M.fromListWith best <$> parseLogLines go Index: git-annex-8.20210310/Logs/Remote/Pure.hs =================================================================== --- git-annex-8.20210310.orig/Logs/Remote/Pure.hs +++ git-annex-8.20210310/Logs/Remote/Pure.hs @@ -27,7 +27,7 @@ import Utility.QuickCheck import qualified Data.ByteString.Lazy as L import qualified Data.Map as M import Data.Char -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A import Data.ByteString.Builder calcRemoteConfigMap :: L.ByteString -> M.Map UUID RemoteConfig Index: git-annex-8.20210310/Logs/Trust/Pure.hs =================================================================== --- git-annex-8.20210310.orig/Logs/Trust/Pure.hs +++ git-annex-8.20210310/Logs/Trust/Pure.hs @@ -14,7 +14,7 @@ import Types.TrustLevel import Logs.UUIDBased import qualified Data.ByteString.Lazy as L -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A import qualified Data.Attoparsec.ByteString.Char8 as A8 import Data.ByteString.Builder Index: git-annex-8.20210310/Logs/UUIDBased.hs =================================================================== --- git-annex-8.20210310.orig/Logs/UUIDBased.hs +++ git-annex-8.20210310/Logs/UUIDBased.hs @@ -41,7 +41,8 @@ import Logs.Line import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L -import qualified Data.Attoparsec.ByteString.Lazy as A +import qualified Data.Attoparsec.ByteString as A +import qualified Data.Attoparsec.ByteString.Lazy as AL import qualified Data.Attoparsec.ByteString.Char8 as A8 import Data.ByteString.Builder import qualified Data.DList as D @@ -63,8 +64,8 @@ parseLogOld :: A.Parser a -> L.ByteStrin parseLogOld = parseLogOldWithUUID . const parseLogOldWithUUID :: (UUID -> A.Parser a) -> L.ByteString -> Log a -parseLogOldWithUUID parser = fromMaybe M.empty . A.maybeResult - . A.parse (logParserOld parser) +parseLogOldWithUUID parser = fromMaybe M.empty . AL.maybeResult + . AL.parse (logParserOld parser) logParserOld :: (UUID -> A.Parser a) -> A.Parser (Log a) logParserOld parser = M.fromListWith best <$> parseLogLines go