{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Language.Haskell.Homplexity.CabalFiles
( CabalFile
, CabalPackage(..)
, warnings
, parseCabalFile
, languageExtensions
) where
import Data.Generics.Uniplate.Data as U
import Data.String (fromString)
import Language.Haskell.Extension as Cabal
import Language.Haskell.Exts.Extension as HSE
import Language.Haskell.Exts.SrcLoc
import qualified Data.ByteString as BS
import Language.Haskell.Homplexity.Message
#if MIN_VERSION_Cabal(3,0,0)
import Distribution.PackageDescription.Parsec
import Distribution.Parsec.Warning
import Distribution.Types.GenericPackageDescription
#elif MIN_VERSION_Cabal(2,0,0)
import Distribution.PackageDescription.Parsec
import Distribution.Types.GenericPackageDescription
import Distribution.Parsec.Common
#else
import Distribution.PackageDescription(GenericPackageDescription(..))
import Distribution.PackageDescription.Parse(parsePackageDescription)
import Distribution.ParseUtils
parseGenericPackageDescription = parsePackageDescription . BS.unpack
#endif
data CabalFile = CabalFile
{ CabalFile -> [PWarning]
warnings :: [PWarning]
, CabalFile -> GenericPackageDescription
description :: GenericPackageDescription
}
deriving (Int -> CabalFile -> ShowS
[CabalFile] -> ShowS
CabalFile -> String
(Int -> CabalFile -> ShowS)
-> (CabalFile -> String)
-> ([CabalFile] -> ShowS)
-> Show CabalFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CabalFile -> ShowS
showsPrec :: Int -> CabalFile -> ShowS
$cshow :: CabalFile -> String
show :: CabalFile -> String
$cshowList :: [CabalFile] -> ShowS
showList :: [CabalFile] -> ShowS
Show)
parseCabalFile :: FilePath -> IO (Either Log CabalFile)
parseCabalFile :: String -> IO (Either Log CabalFile)
parseCabalFile String
cabalFilePath = do
ByteString
cabalFile <- String -> IO ByteString
BS.readFile String
cabalFilePath
case ParseResult GenericPackageDescription
-> ([PWarning],
Either (Maybe Version, NonEmpty PError) GenericPackageDescription)
forall a.
ParseResult a
-> ([PWarning], Either (Maybe Version, NonEmpty PError) a)
runParseResult (ParseResult GenericPackageDescription
-> ([PWarning],
Either (Maybe Version, NonEmpty PError) GenericPackageDescription))
-> ParseResult GenericPackageDescription
-> ([PWarning],
Either (Maybe Version, NonEmpty PError) GenericPackageDescription)
forall a b. (a -> b) -> a -> b
$ ByteString -> ParseResult GenericPackageDescription
parseGenericPackageDescription ByteString
cabalFile of
([PWarning]
_, Left (Maybe Version, NonEmpty PError)
err) ->
Either Log CabalFile -> IO (Either Log CabalFile)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Either Log CabalFile -> IO (Either Log CabalFile))
-> Either Log CabalFile -> IO (Either Log CabalFile)
forall a b. (a -> b) -> a -> b
$ Log -> Either Log CabalFile
forall a b. a -> Either a b
Left (Log -> Either Log CabalFile) -> Log -> Either Log CabalFile
forall a b. (a -> b) -> a -> b
$ SrcLoc -> String -> Log
critical (String -> Int -> Int -> SrcLoc
SrcLoc String
cabalFilePath Int
0 Int
0) ((Maybe Version, NonEmpty PError) -> String
forall a. Show a => a -> String
show (Maybe Version, NonEmpty PError)
err)
([PWarning]
warns, Right GenericPackageDescription
desc) ->
Either Log CabalFile -> IO (Either Log CabalFile)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Either Log CabalFile -> IO (Either Log CabalFile))
-> Either Log CabalFile -> IO (Either Log CabalFile)
forall a b. (a -> b) -> a -> b
$ CabalFile -> Either Log CabalFile
forall a b. b -> Either a b
Right (CabalFile -> Either Log CabalFile)
-> CabalFile -> Either Log CabalFile
forall a b. (a -> b) -> a -> b
$ [PWarning] -> GenericPackageDescription -> CabalFile
CabalFile [PWarning]
warns GenericPackageDescription
desc
cabalExtensionToHseExtension :: Cabal.Extension -> HSE.Extension
cabalExtensionToHseExtension :: Extension -> Extension
cabalExtensionToHseExtension (Cabal.UnknownExtension String
ex) = String -> Extension
HSE.UnknownExtension String
ex
cabalExtensionToHseExtension (Cabal.EnableExtension KnownExtension
ex) = KnownExtension -> Extension
HSE.EnableExtension (KnownExtension -> KnownExtension
cabalKnownExtensionToHseKnownExtension KnownExtension
ex)
cabalExtensionToHseExtension (Cabal.DisableExtension KnownExtension
ex) = KnownExtension -> Extension
HSE.DisableExtension (KnownExtension -> KnownExtension
cabalKnownExtensionToHseKnownExtension KnownExtension
ex)
cabalKnownExtensionToHseKnownExtension :: Cabal.KnownExtension -> HSE.KnownExtension
cabalKnownExtensionToHseKnownExtension :: KnownExtension -> KnownExtension
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.OverlappingInstances = KnownExtension
HSE.OverlappingInstances
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.Arrows = KnownExtension
HSE.Arrows
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.BangPatterns = KnownExtension
HSE.BangPatterns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.BinaryLiterals = KnownExtension
HSE.BinaryLiterals
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.CApiFFI = KnownExtension
HSE.CApiFFI
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.CPP = KnownExtension
HSE.CPP
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ConstrainedClassMethods = KnownExtension
HSE.ConstrainedClassMethods
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ConstraintKinds = KnownExtension
HSE.ConstraintKinds
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DataKinds = KnownExtension
HSE.DataKinds
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DatatypeContexts = KnownExtension
HSE.DatatypeContexts
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DefaultSignatures = KnownExtension
HSE.DefaultSignatures
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveDataTypeable = KnownExtension
HSE.DeriveDataTypeable
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveFoldable = KnownExtension
HSE.DeriveFoldable
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveFunctor = KnownExtension
HSE.DeriveFunctor
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveGeneric = KnownExtension
HSE.DeriveGeneric
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveTraversable = KnownExtension
HSE.DeriveTraversable
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DisambiguateRecordFields = KnownExtension
HSE.DisambiguateRecordFields
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DoAndIfThenElse = KnownExtension
HSE.DoAndIfThenElse
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DoRec = KnownExtension
HSE.DoRec
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.EmptyDataDecls = KnownExtension
HSE.EmptyDataDecls
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ExistentialQuantification = KnownExtension
HSE.ExistentialQuantification
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ExplicitForAll = KnownExtension
HSE.ExplicitForAll
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ExplicitNamespaces = KnownExtension
HSE.ExplicitNamespaces
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ExtendedDefaultRules = KnownExtension
HSE.ExtendedDefaultRules
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ExtensibleRecords = KnownExtension
HSE.ExtensibleRecords
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.FlexibleContexts = KnownExtension
HSE.FlexibleContexts
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.FlexibleInstances = KnownExtension
HSE.FlexibleInstances
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ForeignFunctionInterface = KnownExtension
HSE.ForeignFunctionInterface
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.FunctionalDependencies = KnownExtension
HSE.FunctionalDependencies
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.GADTs = KnownExtension
HSE.GADTs
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.GHCForeignImportPrim = KnownExtension
HSE.GHCForeignImportPrim
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.GeneralizedNewtypeDeriving = KnownExtension
HSE.GeneralizedNewtypeDeriving
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.Generics = KnownExtension
HSE.Generics
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.HereDocuments = KnownExtension
HSE.HereDocuments
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ImplicitParams = KnownExtension
HSE.ImplicitParams
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ImplicitPrelude = KnownExtension
HSE.ImplicitPrelude
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ImpredicativeTypes = KnownExtension
HSE.ImpredicativeTypes
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.IncoherentInstances = KnownExtension
HSE.IncoherentInstances
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.InstanceSigs = KnownExtension
HSE.InstanceSigs
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.InterruptibleFFI = KnownExtension
HSE.InterruptibleFFI
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.KindSignatures = KnownExtension
HSE.KindSignatures
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.LambdaCase = KnownExtension
HSE.LambdaCase
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.LiberalTypeSynonyms = KnownExtension
HSE.LiberalTypeSynonyms
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MagicHash = KnownExtension
HSE.MagicHash
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MonoLocalBinds = KnownExtension
HSE.MonoLocalBinds
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MonoPatBinds = KnownExtension
HSE.MonoPatBinds
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MonomorphismRestriction = KnownExtension
HSE.MonomorphismRestriction
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MultiParamTypeClasses = KnownExtension
HSE.MultiParamTypeClasses
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.MultiWayIf = KnownExtension
HSE.MultiWayIf
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.NPlusKPatterns = KnownExtension
HSE.NPlusKPatterns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.NamedFieldPuns = KnownExtension
HSE.NamedFieldPuns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.NamedWildCards = KnownExtension
HSE.NamedWildCards
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.NewQualifiedOperators = KnownExtension
HSE.NewQualifiedOperators
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.NondecreasingIndentation = KnownExtension
HSE.NondecreasingIndentation
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.OverloadedLabels = KnownExtension
HSE.OverloadedLabels
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.OverloadedStrings = KnownExtension
HSE.OverloadedStrings
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PackageImports = KnownExtension
HSE.PackageImports
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ParallelArrays = KnownExtension
HSE.ParallelArrays
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ParallelListComp = KnownExtension
HSE.ParallelListComp
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PartialTypeSignatures = KnownExtension
HSE.PartialTypeSignatures
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PatternGuards = KnownExtension
HSE.PatternGuards
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PatternSignatures = KnownExtension
HSE.PatternSignatures
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PatternSynonyms = KnownExtension
HSE.PatternSynonyms
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PolyKinds = KnownExtension
HSE.PolyKinds
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PolymorphicComponents = KnownExtension
HSE.PolymorphicComponents
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.PostfixOperators = KnownExtension
HSE.PostfixOperators
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.QuasiQuotes = KnownExtension
HSE.QuasiQuotes
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.Rank2Types = KnownExtension
HSE.Rank2Types
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RankNTypes = KnownExtension
HSE.RankNTypes
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RebindableSyntax = KnownExtension
HSE.RebindableSyntax
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RecordPuns = KnownExtension
HSE.RecordPuns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RecordWildCards = KnownExtension
HSE.RecordWildCards
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RecursiveDo = KnownExtension
HSE.RecursiveDo
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RegularPatterns = KnownExtension
HSE.RegularPatterns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RelaxedPolyRec = KnownExtension
HSE.RelaxedPolyRec
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RestrictedTypeSynonyms = KnownExtension
HSE.RestrictedTypeSynonyms
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.RoleAnnotations = KnownExtension
HSE.RoleAnnotations
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.Safe = KnownExtension
HSE.Safe
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.SafeImports = KnownExtension
HSE.SafeImports
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ScopedTypeVariables = KnownExtension
HSE.ScopedTypeVariables
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.StandaloneDeriving = KnownExtension
HSE.StandaloneDeriving
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TemplateHaskell = KnownExtension
HSE.TemplateHaskell
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TransformListComp = KnownExtension
HSE.TransformListComp
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.Trustworthy = KnownExtension
HSE.Trustworthy
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TupleSections = KnownExtension
HSE.TupleSections
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TypeApplications = KnownExtension
HSE.TypeApplications
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TypeFamilies = KnownExtension
HSE.TypeFamilies
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TypeOperators = KnownExtension
HSE.TypeOperators
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TypeSynonymInstances = KnownExtension
HSE.TypeSynonymInstances
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.UnboxedTuples = KnownExtension
HSE.UnboxedTuples
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.UndecidableInstances = KnownExtension
HSE.UndecidableInstances
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.UnicodeSyntax = KnownExtension
HSE.UnicodeSyntax
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.UnliftedFFITypes = KnownExtension
HSE.UnliftedFFITypes
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.ViewPatterns = KnownExtension
HSE.ViewPatterns
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.XmlSyntax = KnownExtension
HSE.XmlSyntax
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DeriveAnyClass = KnownExtension
HSE.DeriveAnyClass
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.DerivingStrategies = KnownExtension
HSE.DerivingStrategies
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.EmptyCase = KnownExtension
HSE.EmptyCase
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.JavaScriptFFI = KnownExtension
HSE.JavaScriptFFI
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.TypeFamilyDependencies = KnownExtension
HSE.TypeFamilyDependencies
cabalKnownExtensionToHseKnownExtension KnownExtension
Cabal.UnboxedSums = KnownExtension
HSE.UnboxedSums
cabalKnownExtensionToHseKnownExtension KnownExtension
ex = String -> KnownExtension
forall a. HasCallStack => String -> a
error (String -> KnownExtension) -> String -> KnownExtension
forall a b. (a -> b) -> a -> b
$ String
"Extension '" String -> ShowS
forall a. [a] -> [a] -> [a]
++ KnownExtension -> String
forall a. Show a => a -> String
show KnownExtension
ex String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"' unsupported"
data CabalPackage = Library | Package String
languageExtensions :: CabalPackage -> CabalFile -> [HSE.Extension]
languageExtensions :: CabalPackage -> CabalFile -> [Extension]
languageExtensions CabalPackage
moduleName CabalFile{GenericPackageDescription
description :: CabalFile -> GenericPackageDescription
description :: GenericPackageDescription
description} = (Extension -> Extension) -> [Extension] -> [Extension]
forall a b. (a -> b) -> [a] -> [b]
map Extension -> Extension
cabalExtensionToHseExtension ([Extension] -> [Extension]) -> [Extension] -> [Extension]
forall a b. (a -> b) -> a -> b
$ CabalPackage -> [Extension]
languageExtensions' CabalPackage
moduleName
where
languageExtensions' :: CabalPackage -> [Extension]
languageExtensions' CabalPackage
Library = [Extension
e | (Extension
e :: Cabal.Extension) <- Maybe (CondTree ConfVar [Dependency] Library) -> [Extension]
forall from to. Biplate from to => from -> [to]
U.universeBi (GenericPackageDescription
-> Maybe (CondTree ConfVar [Dependency] Library)
condLibrary GenericPackageDescription
description)]
languageExtensions' (Package String
pname) =
let pname' :: UnqualComponentName
pname' = String -> UnqualComponentName
forall a. IsString a => String -> a
fromString String
pname
filt :: [(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
filt = ((UnqualComponentName, b) -> Bool)
-> [(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(UnqualComponentName
name,b
_) -> UnqualComponentName
name UnqualComponentName -> UnqualComponentName -> Bool
forall a. Eq a => a -> a -> Bool
== UnqualComponentName
pname')
in [Extension
e | (Extension
e :: Cabal.Extension) <- [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
-> [Extension]
forall from to. Biplate from to => from -> [to]
U.universeBi ([(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
forall {b}.
[(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
filt ([(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)])
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
forall a b. (a -> b) -> a -> b
$ GenericPackageDescription
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
condForeignLibs GenericPackageDescription
description)] [Extension] -> [Extension] -> [Extension]
forall a. [a] -> [a] -> [a]
++
[Extension
e | (Extension
e :: Cabal.Extension) <- [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
-> [Extension]
forall from to. Biplate from to => from -> [to]
U.universeBi ([(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
forall {b}.
[(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
filt ([(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)])
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
forall a b. (a -> b) -> a -> b
$ GenericPackageDescription
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
condExecutables GenericPackageDescription
description)] [Extension] -> [Extension] -> [Extension]
forall a. [a] -> [a] -> [a]
++
[Extension
e | (Extension
e :: Cabal.Extension) <- [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> [Extension]
forall from to. Biplate from to => from -> [to]
U.universeBi ([(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
forall {b}.
[(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
filt ([(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] TestSuite)])
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
forall a b. (a -> b) -> a -> b
$ GenericPackageDescription
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
condTestSuites GenericPackageDescription
description) ] [Extension] -> [Extension] -> [Extension]
forall a. [a] -> [a] -> [a]
++
[Extension
e | (Extension
e :: Cabal.Extension) <- [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> [Extension]
forall from to. Biplate from to => from -> [to]
U.universeBi ([(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
forall {b}.
[(UnqualComponentName, b)] -> [(UnqualComponentName, b)]
filt ([(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Benchmark)])
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
forall a b. (a -> b) -> a -> b
$ GenericPackageDescription
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
condBenchmarks GenericPackageDescription
description) ]