| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Cartel.Betsy.Internal
Contents
Description
- data Error
- renderError :: Error -> String
- newtype Betsy m a = Betsy ([Flag] -> m (Either Error (a, [Flag])))
- data Flag = Flag FlagName FlagOpts
- data FlagOpts = FlagOpts {}
- data FlagName = FlagName {}
- makeFlag :: Applicative m => NonEmptyString -> FlagOpts -> Betsy m FlagName
- runBetsy :: Betsy m a -> m (Either Error (a, [Flag]))
- currentFlags :: Applicative f => Betsy f [Flag]
Documentation
Errors that may result from running a Betsy computation.
Constructors
| DuplicateFlag FlagName | The user requested creation of a duplicate flag. |
| Failed String |
|
| EmptyFlagName | The user requested creation of a flag with an empty name. |
renderError :: Error -> String 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.
Flags
The name of a flag, paired with its options.
Options for flags, except for the flag's name.
Constructors
| FlagOpts | |
Fields
| |
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 | |
Fields
| |
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.
currentFlags :: Applicative f => Betsy f [Flag] Source #
Returns a list of all flags made so far.