cartel-0.18.0.2: Specify Cabal files in Haskell

Safe HaskellSafe
LanguageHaskell2010

Cartel.Betsy.Internal

Contents

Description

Internal workings of Betsy, the Cartel flag maker. Use of this module may break Betsy invariants.

Synopsis

Documentation

data Error #

Errors that may result from running a Betsy computation.

Constructors

DuplicateFlag FlagName

The user requested creation of a duplicate flag.

Failed String

fail was invoked.

EmptyFlagName

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

Instances

newtype Betsy m a #

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.

Constructors

Betsy ([Flag] -> m (Either Error (a, [Flag]))) 

Instances

MonadTrans Betsy # 

Methods

lift :: Monad m => m a -> Betsy m a #

Monad m => Monad (Betsy m) # 

Methods

(>>=) :: Betsy m a -> (a -> Betsy m b) -> Betsy m b #

(>>) :: Betsy m a -> Betsy m b -> Betsy m b #

return :: a -> Betsy m a #

fail :: String -> Betsy m a #

Functor m => Functor (Betsy m) # 

Methods

fmap :: (a -> b) -> Betsy m a -> Betsy m b #

(<$) :: a -> Betsy m b -> Betsy m a #

(Monad m, Functor m) => Applicative (Betsy m) # 

Methods

pure :: a -> Betsy m a #

(<*>) :: Betsy m (a -> b) -> Betsy m a -> Betsy m b #

(*>) :: Betsy m a -> Betsy m b -> Betsy m b #

(<*) :: Betsy m a -> Betsy m b -> Betsy m a #

MonadIO m => MonadIO (Betsy m) # 

Methods

liftIO :: IO a -> Betsy m a #

Flags

data Flag #

The name of a flag, paired with its options.

Constructors

Flag FlagName FlagOpts 

Instances

Eq Flag # 

Methods

(==) :: Flag -> Flag -> Bool #

(/=) :: Flag -> Flag -> Bool #

Ord Flag # 

Methods

compare :: Flag -> Flag -> Ordering #

(<) :: Flag -> Flag -> Bool #

(<=) :: Flag -> Flag -> Bool #

(>) :: Flag -> Flag -> Bool #

(>=) :: Flag -> Flag -> Bool #

max :: Flag -> Flag -> Flag #

min :: Flag -> Flag -> Flag #

Show Flag # 

Methods

showsPrec :: Int -> Flag -> ShowS #

show :: Flag -> String #

showList :: [Flag] -> ShowS #

RenderableIndented Flag # 

data FlagOpts #

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

Constructors

FlagOpts 

Fields

  • 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 FlagName #

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.

Constructors

FlagName 

makeFlag #

Arguments

:: 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.

runBetsy #

Arguments

:: Betsy m a 
-> m (Either Error (a, [Flag]))

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

currentFlags :: Applicative f => Betsy f [Flag] #

Returns a list of all flags made so far.