This package uses Data.Generics.PlateData, so
- when Cabal package format changes, we don't have to rewrite anything
- all queries are statically typed
- as a disadvantage, we may suffer some performance loss when doing very complex queries,
anyway most of processing goes while we read package descriptions, not querying them
Example of enduser querying code:
module Main where
import qualified Data.ByteString.Lazy as B
import Distribution.ModuleName hiding (main)
main = (head `fmap` getArgs) >>=
mapM_ (putStrLn . show . (x -> (display $ package x, display $ license x))) .
queryIndex (Not (Id (== GPL)) :& Not (Id (== BSD3)))
You can query any field of PackageDescription no matter how deep it is.
You don't need to provide any type signature for comparison functions,
which are wrapped in Id, as long as you use data constructors for which type can be inferred.
See PackageDescription fields for details.