cartel- Specify Cabal files in Haskell

Safe HaskellSafe-Inferred



Public interface for Betsy, the Cartel flag maker. Simply re-exports safe bindings from Cartel.Betsy.Internal.



data FlagName Source

The name of a flag. Only makeFlag creates flags; it will return a FlagName to you. You can then use that FlagName in a conditional using flag.

data FlagOpts Source

Options for flags, except for the flag's name.




flagDescription :: String

A one-line description of what the flag does; this is optional.

flagDefault :: Bool

Is this flag on or off by default?

flagManual :: Bool

If a flag is manual, Cabal will not change its value. If a flag is not manual, Cabal will change its value automatically to attempt to satisfy the package's dependencies.

data Betsy m a Source

Computations that can create and use Cabal flags. Use of this type, along with the defaultMain function ensures that any FlagName you use has been properly set up by using makeFlag. That way, you don't use flags in a flag without actually declaring the flag. When defaultMain creates your Cabal file, it will print the necessary Flag sections.

Betsy is parameterized on a type, m. When this type is a monad, Betsy is also a monad, allowing you to use use the usual monad combinators and do notation. Betsy is also a monad transformer.


data Error Source

Errors that may result from running a Betsy computation.


DuplicateFlag FlagName

The user requested creation of a duplicate flag.

Failed String

fail was invoked.


The user requested creation of a flag with an empty name.

runBetsy Source


:: Functor m 
=> Betsy m a 
-> m (Either Error (a, [(FlagName, FlagOpts)]))

Returns Left if the making of a flag failed. Otherwise, returns the result of the computation, along with a list of all flags made.

makeFlag Source


:: Applicative m 
=> NonEmptyString

Name of flag

-> FlagOpts

Options for the flag

-> Betsy m FlagName

This operation will fail if there is already a flag with the name you gave.

Creates new flags.

currentFlags :: Applicative f => Betsy f [(FlagName, FlagOpts)] Source

Returns a list of all flags made so far.