-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Helpers for quering .cabal files or hackageDB's 00-index.tar -- -- This package was written to assist you at finding a set of packages, -- which satisfy your needs. At the moment it doesn't have a standalone -- executable, but you can do the queries from your Haskell code. @package cabal-query @version 0.1 -- | This package uses Data.Generics.PlateData, so -- --
-- module Main where -- -- import qualified Data.ByteString.Lazy as B -- import System.Environment -- import Distribution.Query -- import Distribution.Compiler -- import Distribution.License -- import Distribution.ModuleName hiding (main) -- import Distribution.Package -- import Distribution.PackageDescription -- import Distribution.Version -- import Distribution.Text -- import Language.Haskell.Extension -- -- main = (head `fmap` getArgs) >>= -- B.readFile >>= -- 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. module Distribution.Query -- | Queries .cabal files. queryFiles :: Query -> [ByteString] -> [PackageDescription] -- | Queries an index file, which is commonly located at -- ~/.cabal/packages/hackage.haskell.org/00-index.tar in POSIX -- systems. queryIndex :: Query -> ByteString -> [PackageDescription] -- | Heterogenous query tree. Example of constructed query: -- --
-- Not (Id (== GPL)) :& Not (Id (== BSD3)) ---- -- Id takes comparison function as its argument. Commonly this -- must be a partially applied (/=) or (==). Data instance -- is required for PackageDescription traversal. All appropriate -- instances are generated automagically, so you don't have to bother as -- long as Cabal doesn't change its package description format. data Query (:&) :: Query -> Query -> Query (:|) :: Query -> Query -> Query Not :: Query -> Query Id :: (a -> Bool) -> Query