{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes        #-}
-- |
--
-- @since 2.2.0.0
module Distribution.PackageDescription.Quirks (patchQuirks) where

import Distribution.Compat.Prelude
import Distribution.Utils.MD5
import GHC.Fingerprint             (Fingerprint (..))
import Prelude ()

import qualified Data.ByteString as BS
import qualified Data.Map        as Map

-- | Patch legacy @.cabal@ file contents to allow parsec parser to accept
-- all of Hackage.
--
-- Bool part of the result tells whether the output is modified.
--
-- @since 2.2.0.0
patchQuirks :: BS.ByteString -> (Bool, BS.ByteString)
patchQuirks :: ByteString -> (Bool, ByteString)
patchQuirks ByteString
bs = case (ByteString, Fingerprint)
-> Map
     (ByteString, Fingerprint) (Fingerprint, ByteString -> ByteString)
-> Maybe (Fingerprint, ByteString -> ByteString)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup (Int -> ByteString -> ByteString
BS.take Int
256 ByteString
bs, ByteString -> Fingerprint
md5 ByteString
bs) Map
  (ByteString, Fingerprint) (Fingerprint, ByteString -> ByteString)
patches of
    Maybe (Fingerprint, ByteString -> ByteString)
Nothing -> (Bool
False, ByteString
bs)
    Just (Fingerprint
post, ByteString -> ByteString
f)
        | Fingerprint
post Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
/= ByteString -> Fingerprint
md5 ByteString
output -> (Bool
False, ByteString
bs)
        | Bool
otherwise          -> (Bool
True, ByteString
output)
      where
        output :: ByteString
output = ByteString -> ByteString
f ByteString
bs

-- | 'patches' contains first 256 bytes, pre- and post-fingerprints and a patch function.
patches :: Map.Map (BS.ByteString, Fingerprint) (Fingerprint, BS.ByteString -> BS.ByteString)
patches :: Map
  (ByteString, Fingerprint) (Fingerprint, ByteString -> ByteString)
patches = [((ByteString, Fingerprint),
  (Fingerprint, ByteString -> ByteString))]
-> Map
     (ByteString, Fingerprint) (Fingerprint, ByteString -> ByteString)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
    -- http://hackage.haskell.org/package/unicode-transforms-0.3.3
    -- other-modules: .
    -- ReadP assumed dot is empty line
    [ ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- This file has been generated from package.yaml by hpack version 0.17.0.\n--\n-- see: https://github.com/sol/hpack\n\nname:                unicode-transforms\nversion:             0.3.3\nsynopsis:            Unicode normalization\ndescription:         Fast Unic"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
15958160436627155571 Word64
10318709190730872881)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11008465475756725834 Word64
13815629925116264363)
         (ByteString -> ByteString -> ByteString
bsRemove ByteString
"  other-modules:\n      .\n") -- TODO: remove traling \n to test structural-diff
    -- http://hackage.haskell.org/package/DSTM-0.1.2
    -- http://hackage.haskell.org/package/DSTM-0.1.1
    -- http://hackage.haskell.org/package/DSTM-0.1
    -- Other Modules: no dash
    -- ReadP parsed as section
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name: DSTM\nVersion: 0.1.2\nCopyright: (c) 2010, Frank Kupke\nLicense: LGPL\nLicense-File: LICENSE\nAuthor: Frank Kupke\nMaintainer: frk@informatik.uni-kiel.de\nCabal-Version: >= 1.2.3\nStability: provisional\nSynopsis: A framework for using STM within distributed "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6919263071548559054 Word64
9050746360708965827)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17015177514298962556 Word64
11943164891661867280)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Other modules:" ByteString
"-- ")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name: DSTM\nVersion: 0.1.1\nCopyright: (c) 2010, Frank Kupke\nLicense: LGPL\nLicense-File: LICENSE\nAuthor: Frank Kupke\nMaintainer: frk@informatik.uni-kiel.de\nCabal-Version: >= 1.2.3\nStability: provisional\nSynopsis: A framework for using STM within distributed "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17313105789069667153 Word64
9610429408495338584)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17250946493484671738 Word64
17629939328766863497)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Other modules:" ByteString
"-- ")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name: DSTM\nVersion: 0.1\nCopyright: (c) 2010, Frank Kupke\nLicense: LGPL\nLicense-File: LICENSE\nAuthor: Frank Kupke\nMaintainer: frk@informatik.uni-kiel.de\nCabal-Version: >= 1.2.3\nStability: provisional\nSynopsis: A framework for using STM within distributed sy"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10502599650530614586 Word64
16424112934471063115)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
13562014713536696107 Word64
17899511905611879358)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Other modules:" ByteString
"-- ")
    -- http://hackage.haskell.org/package/control-monad-exception-mtl-0.10.3
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name: control-monad-exception-mtl\nversion: 0.10.3\nCabal-Version:  >= 1.10\nbuild-type: Simple\nlicense: PublicDomain\nauthor: Pepe Iborra\nmaintainer: pepeiborra@gmail.com\nhomepage: http://pepeiborra.github.com/control-monad-exception\nsynopsis: MTL instances f"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
18274748422558568404 Word64
4043538769550834851)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11395257416101232635 Word64
4303318131190196308)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
" default- extensions:" ByteString
"unknown-section")
    -- http://hackage.haskell.org/package/vacuum-opengl-0.0
    -- \DEL character
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                vacuum-opengl\nVersion:             0.0\nSynopsis:            Visualize live Haskell data structures using vacuum, graphviz and OpenGL.\nDescription:         \DELVisualize live Haskell data structures using vacuum, graphviz and OpenGL.\n     "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
5946760521961682577 Word64
16933361639326309422)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14034745101467101555 Word64
14024175957788447824)
         (ByteString -> ByteString -> ByteString
bsRemove ByteString
"\DEL")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                vacuum-opengl\nVersion:             0.0.1\nSynopsis:            Visualize live Haskell data structures using vacuum, graphviz and OpenGL.\nDescription:         \DELVisualize live Haskell data structures using vacuum, graphviz and OpenGL.\n   "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10790950110330119503 Word64
1309560249972452700)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1565743557025952928 Word64
13645502325715033593)
         (ByteString -> ByteString -> ByteString
bsRemove ByteString
"\DEL")
    -- http://hackage.haskell.org/package/ixset-1.0.4
    -- {- comments -}
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                ixset\nVersion:             1.0.4\nSynopsis:            Efficient relational queries on Haskell sets.\nDescription:\n    Create and query sets that are indexed by multiple indices.\nLicense:             BSD3\nLicense-file:        COPYING\nAut"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11886092342440414185 Word64
4150518943472101551)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
5731367240051983879 Word64
17473925006273577821)
         (ByteString -> ByteString -> ByteString
bsRemoveStarting ByteString
"{-")
    -- : after section
    -- http://hackage.haskell.org/package/ds-kanren
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                ds-kanren\nversion:             0.2.0.0\nsynopsis:            A subset of the miniKanren language\ndescription:\n  ds-kanren is an implementation of the <http://minikanren.org miniKanren> language.\n  .\n  == What's in ds-kanren?\n  .\n  ['dis"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
2804006762382336875 Word64
9677726932108735838)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9830506174094917897 Word64
12812107316777006473)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Test-Suite test-unify:" ByteString
"Test-Suite \"test-unify:\"" (ByteString -> ByteString)
-> (ByteString -> ByteString) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Test-Suite test-list-ops:" ByteString
"Test-Suite \"test-list-ops:\"")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                ds-kanren\nversion:             0.2.0.1\nsynopsis:            A subset of the miniKanren language\ndescription:\n  ds-kanren is an implementation of the <http://minikanren.org miniKanren> language.\n\nlicense:             MIT\nlicense-file:  "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9130259649220396193 Word64
2155671144384738932)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1847988234352024240 Word64
4597789823227580457)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Test-Suite test-unify:" ByteString
"Test-Suite \"test-unify:\"" (ByteString -> ByteString)
-> (ByteString -> ByteString) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"Test-Suite test-list-ops:" ByteString
"Test-Suite \"test-list-ops:\"")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                metric\nversion:             0.1.4\nsynopsis:            Metric spaces.\nlicense:             MIT\nlicense-file:        LICENSE\nauthor:              Vikram Verma\nmaintainer:          me@vikramverma.com\ncategory:            Data\nbuild-type:"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6150019278861565482 Word64
3066802658031228162)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9124826020564520548 Word64
15629704249829132420)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"test-suite metric-tests:" ByteString
"test-suite \"metric-tests:\"")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                metric\nversion:             0.2.0\nsynopsis:            Metric spaces.\nlicense:             MIT\nlicense-file:        LICENSE\nauthor:              Vikram Verma\nmaintainer:          me@vikramverma.com\ncategory:            Data\nbuild-type:"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
4639805967994715694 Word64
7859317050376284551)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
5566222290622325231 Word64
873197212916959151)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"test-suite metric-tests:" ByteString
"test-suite \"metric-tests:\"")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:          phasechange\ncategory:      Data\nversion:       0.1\nauthor:        G\195\161bor Lehel\nmaintainer:    G\195\161bor Lehel <illissius@gmail.com>\nhomepage:      http://github.com/glehel/phasechange\ncopyright:     Copyright (C) 2012 G\195\161bor Lehel\nlicense:     "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10546509771395401582 Word64
245508422312751943)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
5169853482576003304 Word64
7247091607933993833)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"impl(ghc >= 7.4):" ByteString
"erroneous-section" (ByteString -> ByteString)
-> (ByteString -> ByteString) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"impl(ghc >= 7.6):" ByteString
"erroneous-section")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                smartword\nSynopsis:            Web based flash card for Word Smart I and II vocabularies\nVersion:             0.0.0.5\nHomepage:            http://kyagrd.dyndns.org/~kyagrd/project/smartword/\nCategory:            Web,Education\nLicense: "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
7803544783533485151 Word64
10807347873998191750)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1665635316718752601 Word64
16212378357991151549)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"build depends:" ByteString
"--")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:           shelltestrunner\n-- sync with README.md, ANNOUNCE:\nversion:        1.3\ncategory:       Testing\nsynopsis:       A tool for testing command-line programs.\ndescription:\n shelltestrunner is a cross-platform tool for testing command-line\n program"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
4403237110790078829 Word64
15392625961066653722)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10218887328390239431 Word64
4644205837817510221)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"other modules:" ByteString
"--")
    -- &&!
    -- http://hackage.haskell.org/package/hblas-0.3.0.0
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further \n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP) \n-- "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
8570120150072467041 Word64
18315524331351505945)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10838007242302656005 Word64
16026440017674974175)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further \n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP) \n-- "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
5262875856214215155 Word64
10846626274067555320)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3022954285783401045 Word64
13395975869915955260)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further \n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP) \n-- "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
54222628930951453 Word64
5526514916844166577)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1749630806887010665 Word64
8607076506606977549)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP)\n-- fo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6817250511240350300 Word64
15278852712000783849)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
15757717081429529536 Word64
15542551865099640223)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP)\n-- fo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
8310050400349211976 Word64
201317952074418615)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10283381191257209624 Word64
4231947623042413334)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP)\n-- fo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
7010988292906098371 Word64
11591884496857936132)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6158672440010710301 Word64
6419743768695725095)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\r\n-- documentation, see http://haskell.org/cabal/users-guide/\r\n\r\n-- The name of the package.\r\nname:                hblas\r\n\r\n-- The package version.  See the Haskell package versioning policy (PVP)"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
2076850805659055833 Word64
16615160726215879467)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10634706281258477722 Word64
5285812379517916984)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\r\n-- documentation, see http://haskell.org/cabal/users-guide/\r\n\r\n-- The name of the package.\r\nname:                hblas\r\n\r\n-- The package version.  See the Haskell package versioning policy (PVP)"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11850020631622781099 Word64
11956481969231030830)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
13702868780337762025 Word64
13383526367149067158)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial hblas.cabal generated by cabal init.  For further\n-- documentation, see http://haskell.org/cabal/users-guide/\n\n-- The name of the package.\nname:                hblas\n\n-- The package version.  See the Haskell package versioning policy (PVP)\n-- fo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
13690322768477779172 Word64
19704059263540994)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11189374824645442376 Word64
8363528115442591078)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"&&!" ByteString
"&& !")
    -- flag used, but not defined
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                brainheck\nversion:             0.1.0.2\nsynopsis:            Brainh*ck interpreter in haskell\ndescription:         Brainh*ck interpreter written in haskell and taking advantage of many prominent libraries\nhomepage:            https://gi"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6910727116443152200 Word64
15401634478524888973)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
16551412117098094368 Word64
16260377389127603629)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                brainheck\r\nversion:             0.1.0.2\r\nx-revision: 1\r\nsynopsis:            Brainh*ck interpreter in haskell\r\ndescription:         Brainh*ck interpreter written in haskell and taking advantage of many prominent libraries\r\nhomepage:   "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14320987921316832277 Word64
10031098243571536929)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
7959395602414037224 Word64
13279941216182213050)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                brainheck\r\nversion:             0.1.0.2\r\nx-revision: 2\r\nsynopsis:            Brainh*ck interpreter in haskell\r\ndescription:         Brainh*ck interpreter written in haskell and taking advantage of many prominent libraries\r\nhomepage:   "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3809078390223299128 Word64
10796026010775813741)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1127231189459220796 Word64
12088367524333209349)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                brainheck\r\nversion:             0.1.0.2\r\nx-revision: 3\r\nsynopsis:            Brainh*ck interpreter in haskell\r\ndescription:         Brainh*ck interpreter written in haskell and taking advantage of many prominent libraries\r\nhomepage:   "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
13860013038089410950 Word64
12479824176801390651)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
4687484721703340391 Word64
8013395164515771785)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\nversion:             0.1.0.1\nsynopsis:            Get word counts and distributions\ndescription:         A command line tool to compute the word distribution from various types of document, converting to text with pandoc.\nho"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
16215911397419608203 Word64
15594928482155652475)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
15120681510314491047 Word64
2666192399775157359)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\r\nversion:             0.1.0.1\r\nx-revision: 1\r\nsynopsis:            Get word counts and distributions\r\ndescription:         A command line tool to compute the word distribution from various types of document, converting to te"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
16593139224723441188 Word64
4052919014346212001)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3577381082410411593 Word64
11481899387780544641)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\nversion:             0.1.0.2\nsynopsis:            Get word counts and distributions\ndescription:         A command line tool to compute the word distribution from various types of document, converting to text with pandoc.\nho"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9321301260802539374 Word64
1316392715016096607)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3784628652257760949 Word64
12662640594755291035)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\r\nversion:             0.1.0.2\r\nx-revision: 1\r\nsynopsis:            Get word counts and distributions\r\ndescription:         A command line tool to compute the word distribution from various types of document, converting to te"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
2546901804824433337 Word64
2059732715322561176)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
8082068680348326500 Word64
615008613291421947)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\nversion:             0.1.0.3\nsynopsis:            Get word counts and distributions\ndescription:         A command line tool to compute the word distribution from various types of document, converting to text with pandoc.\nho"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
2282380737467965407 Word64
12457554753171662424)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17324757216926991616 Word64
17172911843227482125)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                wordchoice\r\nversion:             0.1.0.3\r\nx-revision: 1\r\nsynopsis:            Get word counts and distributions\r\ndescription:         A command line tool to compute the word distribution from various types of document, converting to te"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12907988890480595481 Word64
11078473638628359710)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
13246185333368731848 Word64
4663060731847518614)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(llvm-fast)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                hw-prim-bits\nversion:             0.1.0.0\nsynopsis:            Primitive support for bit manipulation\ndescription:         Please see README.md\nhomepage:            https://github.com/githubuser/hw-prim-bits#readme\nlicense:            "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12386777729082870356 Word64
17414156731912743711)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3452290353395041602 Word64
14102887112483033720)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(sse42)" ByteString
"False")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                   hw-prim-bits\nversion:                0.1.0.1\nsynopsis:               Primitive support for bit manipulation\ndescription:            Please see README.md\nhomepage:               https://github.com/githubuser/hw-prim-bits#readme\nlicen"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6870520675313101180 Word64
14553457351296240636)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12481021059537696455 Word64
14711088786769892762)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"flag(sse42)" ByteString
"False")
    -- leading zeros in version digits
    -- https://github.com/haskell-infra/hackage-trustees/issues/128
    -- https://github.com/haskell/cabal/issues/5092
    -- https://github.com/haskell/cabal/issues/5138
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:            Sit\nversion:         0.2017.02.26\nbuild-type:      Simple\ncabal-version:   >= 1.8\nlicense:         OtherLicense\nlicense-file:    LICENSE\nauthor:          Anonymous\nmaintainer:      Anonymous\nhomepage:        NONE\ncategory:        Dependent"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
8458530898096910998 Word64
3228538743646501413)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14470502514907936793 Word64
17514354054641875371)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"0.2017.02.26" ByteString
"0.2017.2.26")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:            Sit\nversion:         0.2017.05.01\nbuild-type:      Simple\ncabal-version:   >= 1.8\nlicense:         OtherLicense\nlicense-file:    LICENSE\nauthor:          Andreas Abel <andreas.abel@gu.se>\nmaintainer:      Andreas Abel <andreas.abel@gu.se>\n"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1450130849535097473 Word64
11742099607098860444)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
16679762943850814021 Word64
4253724355613883542)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"0.2017.05.01" ByteString
"0.2017.5.1")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:            Sit\nversion:         0.2017.05.02\nbuild-type:      Simple\ncabal-version:   >= 1.8\nlicense:         OtherLicense\nlicense-file:    LICENSE\nauthor:          Andreas Abel <andreas.abel@gu.se>\nmaintainer:      Andreas Abel <andreas.abel@gu.se>\n"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
297248532398492441 Word64
17322625167861324800)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
634812045126693280 Word64
1755581866539318862)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"0.2017.05.02" ByteString
"0.2017.5.2")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:            Sit\nversion:         0.2017.5.02\nx-revision: 1\n-- x-revision:1 see https://github.com/haskell-infra/hackage-trustees/issues/128\nbuild-type:      Simple\ncabal-version:   >= 1.8\nlicense:         OtherLicense\nlicense-file:    LICENSE\nauthor: "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3697869560530373941 Word64
3942982281026987312)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14344526114710295386 Word64
16386400353475114712)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"0.2017.5.02" ByteString
"0.2017.5.2")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:            MiniAgda\nversion:         0.2017.02.18\nbuild-type:      Simple\ncabal-version:   >= 1.22\nlicense:         OtherLicense\nlicense-file:    LICENSE\nauthor:          Andreas Abel and Karl Mehltretter\nmaintainer:      Andreas Abel <andreas.abel@i"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17167128953451088679 Word64
4300350537748753465)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12402236925293025673 Word64
7715084875284020606)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"0.2017.02.18" ByteString
"0.2017.2.18")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"cabal-version:\n  2.0\nname:\n  fast-downward\nversion:\n  0.1.0.0\nbuild-type:\n  Simple\nsynopsis:\n  Solve classical planning problems (STRIPS/SAS+) using Haskell & Fast Downward.\ndescription:\n  @fast-downward@ is a library for modelling classical planning probl"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11256076039027887363 Word64
6867903407496243216)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12159816716813155434 Word64
5278015399212299853)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"1.2.03.0" ByteString
"1.2.3.0")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"cabal-version:\r\n  2.0\r\nname:\r\n  fast-downward\r\nversion:\r\n  0.1.0.0\r\nx-revision: \r\n  1\r\nbuild-type:\r\n  Simple\r\nsynopsis:\r\n  Solve classical planning problems (STRIPS/SAS+) using Haskell & Fast Downward.\r\ndescription:\r\n  @fast-downward@ is a library for mode"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9216193973149680231 Word64
893446343655828508)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
10020169545407746427 Word64
1828336750379510675)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"1.2.03.0" ByteString
"1.2.3.0")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"cabal-version:\n  2.0\nname:\n  fast-downward\nversion:\n  0.1.0.1\nbuild-type:\n  Simple\nsynopsis:\n  Solve classical planning problems (STRIPS/SAS+) using Haskell & Fast Downward.\ndescription:\n  @fast-downward@ is a library for modelling classical planning probl"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9899886602574848632 Word64
5980433644983783334)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12007469255857289958 Word64
8321466548645225439)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"1.2.03.0" ByteString
"1.2.3.0")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"cabal-version:\n  2.0\nname:\n  fast-downward\nversion:\n  0.1.1.0\nbuild-type:\n  Simple\nsynopsis:\n  Solve classical planning problems (STRIPS/SAS+) using Haskell & Fast Downward.\ndescription:\n  @fast-downward@ is a library for modelling classical planning probl"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12694656661460787751 Word64
1902242956706735615)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
15433152131513403849 Word64
2284712791516353264)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"1.2.03.0" ByteString
"1.2.3.0")
    -- 9 digits limit
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                SGplus\nVersion:             1.1\nSynopsis:            (updated) Small geometry library for dealing with vectors and collision detection\nLicense:             BSD3\nLicense-file:        LICENSE\nAuthor:              Neil Brown\nMaintainer:  "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17735649550442248029 Word64
11493772714725351354)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9565458801063261772 Word64
15955773698774721052)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"1000000000" ByteString
"100000000")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial control-dotdotdot.cabal generated by cabal init.  For further \n-- documentation, see http://haskell.org/cabal/users-guide/\n\nname:                control-dotdotdot\nversion:             0.1.0.1\nsynopsis:            Haskell operator\n               "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1514257173776509942 Word64
7756050823377346485)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14082092642045505999 Word64
18415918653404121035)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"9223372036854775807" ByteString
"5")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                data-foldapp\r\nversion:             0.1.1.0\r\nsynopsis:            Fold function applications. Framework for variadic functions.\r\ndescription:         Fold function applications. Framework for variadic functions.\r\nhomepage:            ht"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
4511234156311243251 Word64
11701153011544112556)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
11820542702491924189 Word64
4902231447612406724)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"9223372036854775807" ByteString
"999" (ByteString -> ByteString)
-> (ByteString -> ByteString) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"9223372036854775807" ByteString
"999")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"-- Initial data-list-zigzag.cabal generated by cabal init.  For further \r\n-- documentation, see http://haskell.org/cabal/users-guide/\r\n\r\nname:                data-list-zigzag\r\nversion:             0.1.1.1\r\nsynopsis:            A list but with a balanced en"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12475837388692175691 Word64
18053834261188158945)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
16279938253437334942 Word64
15753349540193002309)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"9223372036854775807" ByteString
"999")
    -- Not UTF8
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"Name:                     nat\nVersion:                  0.1\nDescription:            Implementation of natural numbers and integers by a binary\n                                representation. The implementation is supposed to be lazy and\n                   "
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9222512268705577108 Word64
13085311382746579495)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17468921266614378430 Word64
13221316288008291892)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"\xf6" ByteString
"\xc3\xb6")
    -- cabal-version: 2
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                streaming-bracketed\nversion:             0.1.0.0\nsynopsis:            A resource management decorator for \"streaming\".        \ndescription:         This package provides a decorator for the Stream type from\n                     the \"st"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
14670044663153191927 Word64
1427497586294143829)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9233007756654759985 Word64
6571998449003682006)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"cabal-version:       2" ByteString
"cabal-version: 2.0")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:                streaming-bracketed\nversion:             0.1.0.1\nsynopsis:            A resource management decorator for \"streaming\".        \ndescription:         This package provides a decorator for the Stream type from\n                     \"stream"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
7298738862909203815 Word64
10141693276062967842)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
1349949738792220441 Word64
3593683359695349293)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"cabal-version:       2" ByteString
"cabal-version: 2.0")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name:           zsyntax\nversion:        0.2.0.0\ndescription:    An automated theorem prover for Zsyntax, a\n                logical calculus for molecular biology inspired by linear logic,\n                that can be used to automatically verify biological\n"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
17812331267506881875 Word64
3005293725141563863)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3445957263137759540 Word64
12472369104312474458)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"cabal-version:  2" ByteString
"cabal-version: 2.0")

    -- Empty filepath in not license-file or data-dir
    -- These have hs-source-dirs: ""
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"\nname:                wai-middleware-hmac-client\nversion:             0.1.0.1\nlicense:             BSD3\nlicense-file:        LICENSE\nauthor:              Christopher Reichert\nmaintainer:          creichert07@gmail.com\ncopyright:           (c) 2015, Christo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
3112606538775065787 Word64
11984607507024462091)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
6916432989977230500 Word64
6621389616675138128)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"\"\"" ByteString
".")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"\nname:                wai-middleware-hmac-client\nversion:             0.1.0.2\nlicense:             BSD3\nlicense-file:        LICENSE\nauthor:              Christopher Reichert\nmaintainer:          creichert07@gmail.com\ncopyright:           (c) 2015, Christo"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12566783342663020458 Word64
17562089389615949789)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
15745683452603944938 Word64
10556498036622072844)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"\"\"" ByteString
".")

    -- absolute license-file
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name: reheat\nversion: 0.1.4\ncabal-version: >=1.8\nbuild-type: Simple\nlicense: GPL\nlicense-file: /home/palo/dev/haskell-workspace/playground/reheat/gpl-3.0.txt\ncopyright: GPL\nmaintainer: Ingolf Wagner <palipalo9@gmail.com>\nstability: experimental\nhomepage: h"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
9155400339287317061 Word64
14812953666990892802)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
7687053346032173923 Word64
15384472501136606592)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"/home/palo/dev/haskell-workspace/playground/reheat/gpl-3.0.txt" ByteString
"")
    , ByteString
-> Fingerprint
-> Fingerprint
-> (ByteString -> ByteString)
-> ((ByteString, Fingerprint),
    (Fingerprint, ByteString -> ByteString))
forall {a} {b} {a} {b}. a -> b -> a -> b -> ((a, b), (a, b))
mk ByteString
"name: reheat\nversion: 0.1.5\ncabal-version: >=1.8\nbuild-type: Simple\nlicense: GPL\nlicense-file: /home/palo/dev/haskell-workspace/playground/reheat/gpl-3.0.txt\ncopyright: GPL\nmaintainer: Ingolf Wagner <palipalo9@gmail.com>\nstability: experimental\nhomepage: h"
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
2984391146441073709 Word64
11728234882049907993)
         (Word64 -> Word64 -> Fingerprint
Fingerprint Word64
12058479081855347701 Word64
14017937756688869826)
         (ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
"/home/palo/dev/haskell-workspace/playground/reheat/gpl-3.0.txt" ByteString
"")
    ]
  where
    mk :: a -> b -> a -> b -> ((a, b), (a, b))
mk a
a b
b a
c b
d = ((a
a, b
b), (a
c, b
d))

-- | Helper to create entries in patches
_makePatchKey :: FilePath -> (BS.ByteString -> BS.ByteString) -> IO ()
_makePatchKey :: String -> (ByteString -> ByteString) -> IO ()
_makePatchKey String
fp ByteString -> ByteString
transform = do
    ByteString
contents <- String -> IO ByteString
BS.readFile String
fp
    let output :: ByteString
output = ByteString -> ByteString
transform ByteString
contents
    let Fingerprint Word64
hi Word64
lo = ByteString -> Fingerprint
md5 ByteString
contents
    let Fingerprint Word64
hi' Word64
lo' = ByteString -> Fingerprint
md5 ByteString
output
    String -> IO ()
putStrLn
        (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"    , mk "
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ShowS
forall a. Show a => a -> ShowS
shows (Int -> ByteString -> ByteString
BS.take Int
256 ByteString
contents)
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
"\n         (Fingerprint "
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. Show a => a -> ShowS
shows Word64
hi
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
" "
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. Show a => a -> ShowS
shows Word64
lo
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
")\n         (Fingerprint "
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. Show a => a -> ShowS
shows Word64
hi'
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
" "
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. Show a => a -> ShowS
shows Word64
lo'
        ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString String
")"
        ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String
""

-------------------------------------------------------------------------------
-- Patch helpers
-------------------------------------------------------------------------------

bsRemove
    :: BS.ByteString  -- ^ needle
    -> BS.ByteString -> BS.ByteString
bsRemove :: ByteString -> ByteString -> ByteString
bsRemove ByteString
needle ByteString
haystack = case ByteString -> ByteString -> (ByteString, ByteString)
BS.breakSubstring ByteString
needle ByteString
haystack of
    (ByteString
h, ByteString
t) -> ByteString -> ByteString -> ByteString
BS.append ByteString
h (Int -> ByteString -> ByteString
BS.drop (ByteString -> Int
BS.length ByteString
needle) ByteString
t)

bsReplace
    :: BS.ByteString -- ^ needle
    -> BS.ByteString -- ^ replacement
    -> BS.ByteString -> BS.ByteString
bsReplace :: ByteString -> ByteString -> ByteString -> ByteString
bsReplace ByteString
needle ByteString
repl ByteString
haystack = case ByteString -> ByteString -> (ByteString, ByteString)
BS.breakSubstring ByteString
needle ByteString
haystack of
    (ByteString
h, ByteString
t)
        | Bool -> Bool
not (ByteString -> Bool
BS.null ByteString
t) -> ByteString -> ByteString -> ByteString
BS.append ByteString
h (ByteString -> ByteString -> ByteString
BS.append ByteString
repl (Int -> ByteString -> ByteString
BS.drop (ByteString -> Int
BS.length ByteString
needle) ByteString
t))
        | Bool
otherwise -> ByteString
haystack

bsRemoveStarting
    :: BS.ByteString  -- ^ needle
    -> BS.ByteString -> BS.ByteString
bsRemoveStarting :: ByteString -> ByteString -> ByteString
bsRemoveStarting ByteString
needle ByteString
haystack = case ByteString -> ByteString -> (ByteString, ByteString)
BS.breakSubstring ByteString
needle ByteString
haystack of
    (ByteString
h, ByteString
_) -> ByteString
h