dynamic-cabal-0.3.2: dynamic-cabal

Safe HaskellNone



Functions for building queries on cabal's setup-config an evaluating them.



data Selector i o Source

A selector is a generator for a function of type i -> o.


selector :: (Version -> ExpG (i -> o)) -> Selector i oSource

Build a selector. The expression the selector generates can depend on the cabal version.

data Query s a Source

A query is like a Selector, but it cannot be composed any futher using a Category instance. It can have a Functor and Applicative instance though. To execute a query, you only need to run GHC once.


query :: Typeable a => Selector s a -> Query s aSource

Build a query from a selector.

data LocalBuildInfo Source

This is just a dummy type representing a LocalBuildInfo. You don't have to use this type, it is just used to tag queries and make them more type-safe.

maybeDefault :: (GenExpType a ~ a, GenExp a) => a -> Selector (Maybe a) aSource

A Selector to get something out of a Maybe if you supply a default value.

(>>>=) :: Monad m => Selector a (m b) -> Selector b (m c) -> Selector a (m c)Source

The same as (=<<<), but flipped.

(=<<<) :: Monad m => Selector b (m c) -> Selector a (m b) -> Selector a (m c)Source

Compose two selectors, monadically.

fmapS :: Functor m => Selector a b -> Selector (m a) (m b)Source

Lift a selector to work on functorial inputs and outputs.

fmapQ :: (Functor f, Typeable1 f) => Query s a -> Query (f s) (f a)Source

Lift a query to work over functors.

on :: Selector i o -> Query o r -> Query i rSource

Use a selector to run a query in a bigger environment than it was defined in.

runQuery :: Query LocalBuildInfo a -> FilePath -> IO aSource

Run a query. This will generate the source code for the query and then invoke GHC to run it.

runRawQuery :: Typeable a => String -> FilePath -> IO aSource

Run a raw query, getting the full source from the first parameter the module must be DynamicCabalQuery and it must have a result declaration