cabal-install-parsers 0.4 → 0.4.1
raw patch · 8 files changed
+109/−97 lines, 8 filesdep ~Cabaldep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: Cabal, base
API changes (from Hackage documentation)
- Cabal.SourceRepo: sourceRepositoryPackageGrammar :: (FieldGrammar g, Applicative (g SourceRepoList)) => g SourceRepoList SourceRepoList
+ Cabal.SourceRepo: sourceRepositoryPackageGrammar :: (FieldGrammar c g, Applicative (g SourceRepoList), c (List NoCommaFSep FilePathNT String), c (Identity RepoType)) => g SourceRepoList SourceRepoList
Files
- Changelog.md +4/−0
- cabal-install-parsers.cabal +8/−5
- src/Cabal/Config.hs +7/−8
- src/Cabal/Index.hs +64/−64
- src/Cabal/Internal/Newtypes.hs +8/−8
- src/Cabal/Project.hs +0/−1
- src/Cabal/SourceRepo.hs +15/−9
- test/Golden.hs +3/−2
Changelog.md view
@@ -1,3 +1,7 @@+## 0.4.1++- Use `Cabal-3.4`+ ## 0.4 - Rewrite `Cabal.Index` module
cabal-install-parsers.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: cabal-install-parsers-version: 0.4+version: 0.4.1 synopsis: Utilities to work with cabal-install files description: @cabal-install-parsers@ provides parsers for @cabal-install@ files:@@ -21,7 +21,7 @@ category: Development build-type: Simple tested-with:- GHC ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.3 || ==8.10.1+ GHC ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.3 extra-source-files: Changelog.md@@ -34,7 +34,10 @@ library default-language: Haskell2010- ghc-options: -Wall -Wcompat -Wnoncanonical-monad-instances+ ghc-options:+ -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wcompat -Wnoncanonical-monad-instances+ hs-source-dirs: src exposed-modules: Cabal.Config@@ -54,7 +57,7 @@ , base >=4.10 && <4.15 , binary ^>=0.8.5 , bytestring ^>=0.10.8.1- , Cabal ^>=3.2.0.0+ , Cabal ^>=3.4.0.0 , containers ^>=0.5.7.1 || ^>=0.6.0.1 , deepseq ^>=1.4.2.0 , directory ^>=1.3.0.0@@ -87,8 +90,8 @@ -- inherited constraints build-depends: , base- , bytestring , base16-bytestring+ , bytestring , Cabal , cabal-install-parsers , containers
src/Cabal/Config.hs view
@@ -33,14 +33,13 @@ import System.Environment (lookupEnv) import System.FilePath ((</>)) -import qualified Data.ByteString as BS-import qualified Data.Map.Strict as M-import qualified Distribution.CabalSpecVersion as C-import qualified Distribution.FieldGrammar as C-import qualified Distribution.Fields as C-import qualified Distribution.Parsec as C-import qualified Distribution.Parsec.Newtypes as C-import qualified Distribution.Simple.Utils as C+import qualified Data.ByteString as BS+import qualified Data.Map.Strict as M+import qualified Distribution.CabalSpecVersion as C+import qualified Distribution.FieldGrammar as C+import qualified Distribution.Fields as C+import qualified Distribution.Parsec as C+import qualified Distribution.Simple.Utils as C import Cabal.Internal.Newtypes import Cabal.Parse
src/Cabal/Index.hs view
@@ -190,41 +190,41 @@ -- unsafe construct. You should check the length of bytestring beforehand. sha256Digest :: ByteString -> SHA256 sha256Digest bs = SHA256- ( (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 0)) 56)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 1)) 48)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 2)) 40)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 3)) 32)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 4)) 24)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 5)) 16)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 6)) 8)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 7)) 0)+ ( shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 0)) 56+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 1)) 48+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 2)) 40+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 3)) 32+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 4)) 24+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 5)) 16+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 6)) 8+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 7)) 0 )- ( (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 8)) 56)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 9)) 48)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 10)) 40)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 11)) 32)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 12)) 24)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 13)) 16)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 14)) 8)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 15)) 0)+ ( shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 8)) 56+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 9)) 48+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 10)) 40+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 11)) 32+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 12)) 24+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 13)) 16+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 14)) 8+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 15)) 0 )- ( (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 16)) 56)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 17)) 48)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 18)) 40)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 19)) 32)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 20)) 24)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 21)) 16)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 22)) 8)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 23)) 0)+ ( shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 16)) 56+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 17)) 48+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 18)) 40+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 19)) 32+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 20)) 24+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 21)) 16+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 22)) 8+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 23)) 0 )- ( (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 24)) 56)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 25)) 48)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 26)) 40)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 27)) 32)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 28)) 24)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 29)) 16)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 30)) 8)- .|. (shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 31)) 0)+ ( shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 24)) 56+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 25)) 48+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 26)) 40+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 27)) 32+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 28)) 24+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 29)) 16+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 30)) 8+ .|. shiftL (fromIntegral (BS.Unsafe.unsafeIndex bs 31)) 0 ) -- | Make SHA256 from base16-encoded string.@@ -241,41 +241,41 @@ -- | Get 'ByteString' representation of 'SHA256'. getSHA256 :: SHA256 -> ByteString getSHA256 (SHA256 a b c d) = BS.pack- [ fromIntegral ((shiftR a 56) .&. 0xff)- , fromIntegral ((shiftR a 48) .&. 0xff)- , fromIntegral ((shiftR a 40) .&. 0xff)- , fromIntegral ((shiftR a 32) .&. 0xff)- , fromIntegral ((shiftR a 24) .&. 0xff)- , fromIntegral ((shiftR a 16) .&. 0xff)- , fromIntegral ((shiftR a 8) .&. 0xff)- , fromIntegral ((shiftR a 0) .&. 0xff)+ [ fromIntegral (shiftR a 56 .&. 0xff)+ , fromIntegral (shiftR a 48 .&. 0xff)+ , fromIntegral (shiftR a 40 .&. 0xff)+ , fromIntegral (shiftR a 32 .&. 0xff)+ , fromIntegral (shiftR a 24 .&. 0xff)+ , fromIntegral (shiftR a 16 .&. 0xff)+ , fromIntegral (shiftR a 8 .&. 0xff)+ , fromIntegral (shiftR a 0 .&. 0xff) - , fromIntegral ((shiftR b 56) .&. 0xff)- , fromIntegral ((shiftR b 48) .&. 0xff)- , fromIntegral ((shiftR b 40) .&. 0xff)- , fromIntegral ((shiftR b 32) .&. 0xff)- , fromIntegral ((shiftR b 24) .&. 0xff)- , fromIntegral ((shiftR b 16) .&. 0xff)- , fromIntegral ((shiftR b 8) .&. 0xff)- , fromIntegral ((shiftR b 0) .&. 0xff)+ , fromIntegral (shiftR b 56 .&. 0xff)+ , fromIntegral (shiftR b 48 .&. 0xff)+ , fromIntegral (shiftR b 40 .&. 0xff)+ , fromIntegral (shiftR b 32 .&. 0xff)+ , fromIntegral (shiftR b 24 .&. 0xff)+ , fromIntegral (shiftR b 16 .&. 0xff)+ , fromIntegral (shiftR b 8 .&. 0xff)+ , fromIntegral (shiftR b 0 .&. 0xff) - , fromIntegral ((shiftR c 56) .&. 0xff)- , fromIntegral ((shiftR c 48) .&. 0xff)- , fromIntegral ((shiftR c 40) .&. 0xff)- , fromIntegral ((shiftR c 32) .&. 0xff)- , fromIntegral ((shiftR c 24) .&. 0xff)- , fromIntegral ((shiftR c 16) .&. 0xff)- , fromIntegral ((shiftR c 8) .&. 0xff)- , fromIntegral ((shiftR c 0) .&. 0xff)+ , fromIntegral (shiftR c 56 .&. 0xff)+ , fromIntegral (shiftR c 48 .&. 0xff)+ , fromIntegral (shiftR c 40 .&. 0xff)+ , fromIntegral (shiftR c 32 .&. 0xff)+ , fromIntegral (shiftR c 24 .&. 0xff)+ , fromIntegral (shiftR c 16 .&. 0xff)+ , fromIntegral (shiftR c 8 .&. 0xff)+ , fromIntegral (shiftR c 0 .&. 0xff) - , fromIntegral ((shiftR d 56) .&. 0xff)- , fromIntegral ((shiftR d 48) .&. 0xff)- , fromIntegral ((shiftR d 40) .&. 0xff)- , fromIntegral ((shiftR d 32) .&. 0xff)- , fromIntegral ((shiftR d 24) .&. 0xff)- , fromIntegral ((shiftR d 16) .&. 0xff)- , fromIntegral ((shiftR d 8) .&. 0xff)- , fromIntegral ((shiftR d 0) .&. 0xff)+ , fromIntegral (shiftR d 56 .&. 0xff)+ , fromIntegral (shiftR d 48 .&. 0xff)+ , fromIntegral (shiftR d 40 .&. 0xff)+ , fromIntegral (shiftR d 32 .&. 0xff)+ , fromIntegral (shiftR d 24 .&. 0xff)+ , fromIntegral (shiftR d 16 .&. 0xff)+ , fromIntegral (shiftR d 8 .&. 0xff)+ , fromIntegral (shiftR d 0 .&. 0xff) ] instance C.Pretty SHA256 where
src/Cabal/Internal/Newtypes.hs view
@@ -12,14 +12,14 @@ import Data.Proxy (Proxy (..)) import Network.URI (URI, parseURI, uriToString) -import qualified Data.Set as S-import qualified Distribution.Compat.CharParsing as C-import qualified Distribution.Compat.Newtype as C-import qualified Distribution.Parsec as C-import qualified Distribution.Parsec.Newtypes as C-import qualified Distribution.Pretty as C-import qualified Distribution.Version as C-import qualified Text.PrettyPrint as PP+import qualified Data.Set as S+import qualified Distribution.Compat.CharParsing as C+import qualified Distribution.Compat.Newtype as C+import qualified Distribution.FieldGrammar.Newtypes as C+import qualified Distribution.Parsec as C+import qualified Distribution.Pretty as C+import qualified Distribution.Version as C+import qualified Text.PrettyPrint as PP ------------------------------------------------------------------------------- -- PackageLocation
src/Cabal/Project.hs view
@@ -52,7 +52,6 @@ import qualified Distribution.Fields as C import qualified Distribution.PackageDescription as C import qualified Distribution.Parsec as C-import qualified Distribution.Parsec.Newtypes as C import Cabal.Internal.Glob import Cabal.Internal.Newtypes
src/Cabal/SourceRepo.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-}@@ -20,15 +21,17 @@ sourceRepositoryPackageGrammar, ) where -import Control.DeepSeq (NFData (..))-import Data.List.NonEmpty (NonEmpty (..))-import Data.Proxy (Proxy (..))-import GHC.Generics (Generic)+import Control.DeepSeq (NFData (..))+import Data.Functor.Identity (Identity)+import Data.List.NonEmpty (NonEmpty (..))+import Data.Proxy (Proxy (..))+import GHC.Generics (Generic) -import Distribution.Compat.Lens (Lens, Lens')-import Distribution.FieldGrammar (FieldGrammar, ParsecFieldGrammar', PrettyFieldGrammar', monoidalFieldAla, optionalFieldAla, uniqueField, uniqueFieldAla)-import Distribution.Parsec.Newtypes (FilePathNT (..), NoCommaFSep (..), Token (..), alaList')-import Distribution.Types.SourceRepo (RepoType (..))+import Distribution.Compat.Lens (Lens, Lens')+import Distribution.FieldGrammar+ (FieldGrammar, ParsecFieldGrammar', PrettyFieldGrammar', monoidalFieldAla, optionalFieldAla, uniqueField, uniqueFieldAla)+import Distribution.FieldGrammar.Newtypes (FilePathNT (..), List, NoCommaFSep (..), Token (..), alaList')+import Distribution.Types.SourceRepo (RepoType (..)) -- | @source-repository-package@ definition --@@ -100,7 +103,10 @@ ------------------------------------------------------------------------------- sourceRepositoryPackageGrammar- :: (FieldGrammar g, Applicative (g SourceRepoList))+ :: ( FieldGrammar c g, Applicative (g SourceRepoList)+ , c (List NoCommaFSep FilePathNT String)+ , c (Identity RepoType)+ ) => g SourceRepoList SourceRepoList sourceRepositoryPackageGrammar = SourceRepositoryPackage <$> uniqueField "type" srpTypeLens
test/Golden.hs view
@@ -11,8 +11,8 @@ import qualified Data.ByteString as BS import qualified Data.Map.Strict as Map -import Distribution.Fields (PrettyField(..))-import Distribution.Types.SourceRepo (RepoKind, RepoType, SourceRepo)+import Distribution.Fields (PrettyField (..))+import Distribution.Types.SourceRepo (KnownRepoType, RepoKind, RepoType, SourceRepo) import Cabal.Optimization import Cabal.Parse@@ -56,6 +56,7 @@ instance ToExpr SourceRepo instance ToExpr RepoKind instance ToExpr RepoType+instance ToExpr KnownRepoType instance ToExpr (f FilePath) => ToExpr (SourceRepositoryPackage f) instance ToExpr Doc where