Copyright | (c) 2019-2020 Vaclav Svejcar |
---|---|
License | BSD-3-Clause |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module contains data types representing Headroom configuration options. Related logic is available in Headroom.Configuration module.
Data types related to Headroom configuration uses the
partial options monoid
pattern, but instead of defining separate data type for each phase
(partial or complete configuration), the phase is expressed by the Phase
data type and related closed type family.
Synopsis
- data ConfigurationError
- data ConfigurationKey
- data Phase
- type family (p :: Phase) ::: a where ...
- data Configuration (p :: Phase) = Configuration {
- cRunMode :: p ::: RunMode
- cSourcePaths :: p ::: [FilePath]
- cExcludedPaths :: p ::: [Regex]
- cTemplateSource :: p ::: TemplateSource
- cVariables :: Variables
- cLicenseHeaders :: HeadersConfig p
- cHeaderFnConfigs :: HeaderFnConfigs p
- type CtConfiguration = Configuration 'Complete
- type PtConfiguration = Configuration 'Partial
- data HeadersConfig (p :: Phase) = HeadersConfig {
- hscC :: HeaderConfig p
- hscCpp :: HeaderConfig p
- hscCss :: HeaderConfig p
- hscHaskell :: HeaderConfig p
- hscHtml :: HeaderConfig p
- hscJava :: HeaderConfig p
- hscJs :: HeaderConfig p
- hscPureScript :: HeaderConfig p
- hscRust :: HeaderConfig p
- hscScala :: HeaderConfig p
- hscShell :: HeaderConfig p
- type CtHeadersConfig = HeadersConfig 'Complete
- type PtHeadersConfig = HeadersConfig 'Partial
- data HeaderConfig (p :: Phase) = HeaderConfig {
- hcFileExtensions :: p ::: [Text]
- hcMarginAfter :: p ::: Int
- hcMarginBefore :: p ::: Int
- hcPutAfter :: p ::: [Regex]
- hcPutBefore :: p ::: [Regex]
- hcHeaderSyntax :: p ::: HeaderSyntax
- type CtHeaderConfig = HeaderConfig 'Complete
- type PtHeaderConfig = HeaderConfig 'Partial
- type CtUpdateCopyrightConfig = UpdateCopyrightConfig 'Complete
- type PtUpdateCopyrightConfig = UpdateCopyrightConfig 'Partial
- data UpdateCopyrightConfig (p :: Phase) = UpdateCopyrightConfig {
- uccSelectedAuthors :: p ::: Maybe (NonEmpty Text)
- type CtHeaderFnConfig c = HeaderFnConfig 'Complete c
- type PtHeaderFnConfig c = HeaderFnConfig 'Partial c
- data HeaderFnConfig (p :: Phase) c = HeaderFnConfig {
- hfcEnabled :: p ::: Bool
- hfcConfig :: c p
- type CtHeaderFnConfigs = HeaderFnConfigs 'Complete
- type PtHeaderFnConfigs = HeaderFnConfigs 'Partial
- data HeaderFnConfigs (p :: Phase) = HeaderFnConfigs {}
- data HeaderSyntax
- data GenMode
- data LicenseType
- data RunMode
- data TemplateSource
Error Types
data ConfigurationError Source #
Exception specific to the Headroom.Configuration module.
MissingConfiguration ConfigurationKey | some of the required configuration keys has not been specified |
MixedHeaderSyntax | illegal configuration for |
Instances
Eq ConfigurationError Source # | |
Defined in Headroom.Configuration.Types (==) :: ConfigurationError -> ConfigurationError -> Bool # (/=) :: ConfigurationError -> ConfigurationError -> Bool # | |
Show ConfigurationError Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> ConfigurationError -> ShowS # show :: ConfigurationError -> String # showList :: [ConfigurationError] -> ShowS # | |
Exception ConfigurationError Source # | |
data ConfigurationKey Source #
Represents single key in the configuration.
CkFileExtensions FileType | no configuration for |
CkHeaderSyntax FileType | no configuration for header syntax |
CkMarginAfter FileType | no configuration for |
CkMarginBefore FileType | no configuration for |
CkPutAfter FileType | no configuration for |
CkPutBefore FileType | no configuration for |
CkRunMode | no configuration for |
CkSourcePaths | no configuration for |
CkExcludedPaths | no configuration for |
CkTemplateSource | no configuration for template source |
CkVariables | no configuration for |
CkEnabled | no configuration for |
Instances
Eq ConfigurationKey Source # | |
Defined in Headroom.Configuration.Types (==) :: ConfigurationKey -> ConfigurationKey -> Bool # (/=) :: ConfigurationKey -> ConfigurationKey -> Bool # | |
Show ConfigurationKey Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> ConfigurationKey -> ShowS # show :: ConfigurationKey -> String # showList :: [ConfigurationKey] -> ShowS # |
Type Families
Data type representing state of given configuration data type.
type family (p :: Phase) ::: a where ... Source #
Closed type family used to express the phase of given data type.
Data Types
Top Level Configuration
data Configuration (p :: Phase) Source #
Application configuration.
Configuration | |
|
Instances
type CtConfiguration = Configuration 'Complete Source #
Alias for complete variant of Configuration
.
type PtConfiguration = Configuration 'Partial Source #
Alias for partial variant of Configuration
.
data HeadersConfig (p :: Phase) Source #
Group of HeaderConfig
configurations for supported file types.
HeadersConfig | |
|
Instances
type CtHeadersConfig = HeadersConfig 'Complete Source #
Alias for complete variant of HeadersConfig
.
type PtHeadersConfig = HeadersConfig 'Partial Source #
Alias for partial variant of HeadersConfig
.
data HeaderConfig (p :: Phase) Source #
Configuration for specific license header.
HeaderConfig | |
|
Instances
type CtHeaderConfig = HeaderConfig 'Complete Source #
Alias for complete variant of HeaderConfig
.
type PtHeaderConfig = HeaderConfig 'Partial Source #
Alias for partial variant of HeaderConfig
.
Header Functions
type CtUpdateCopyrightConfig = UpdateCopyrightConfig 'Complete Source #
Alias for complete variant of UpdateCopyrightConfig
.
type PtUpdateCopyrightConfig = UpdateCopyrightConfig 'Partial Source #
Alias for partial variant of UpdateCopyrightConfig
.
data UpdateCopyrightConfig (p :: Phase) Source #
Main configuration for the Headroom.HeaderFn.UpdateCopyright license header function.
UpdateCopyrightConfig | |
|
Instances
Eq PtUpdateCopyrightConfig Source # | |
Defined in Headroom.Configuration.Types | |
Eq CtUpdateCopyrightConfig Source # | |
Defined in Headroom.Configuration.Types | |
Show PtUpdateCopyrightConfig Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> PtUpdateCopyrightConfig -> ShowS # show :: PtUpdateCopyrightConfig -> String # showList :: [PtUpdateCopyrightConfig] -> ShowS # | |
Show CtUpdateCopyrightConfig Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> CtUpdateCopyrightConfig -> ShowS # show :: CtUpdateCopyrightConfig -> String # showList :: [CtUpdateCopyrightConfig] -> ShowS # | |
Semigroup PtUpdateCopyrightConfig Source # | |
Monoid PtUpdateCopyrightConfig Source # | |
FromJSON PtUpdateCopyrightConfig Source # | |
Defined in Headroom.Configuration.Types |
type CtHeaderFnConfig c = HeaderFnConfig 'Complete c Source #
Alias for complete variant of HeaderFnConfig
.
type PtHeaderFnConfig c = HeaderFnConfig 'Partial c Source #
Alias for partial variant of HeaderFnConfig
.
data HeaderFnConfig (p :: Phase) c Source #
Configuration for selected license header function.
HeaderFnConfig | |
|
Instances
type CtHeaderFnConfigs = HeaderFnConfigs 'Complete Source #
Alias for complete variant of HeaderFnConfigs
.
type PtHeaderFnConfigs = HeaderFnConfigs 'Partial Source #
Alias for partial variant of HeaderFnConfigs
.
data HeaderFnConfigs (p :: Phase) Source #
Configuration of all known license header functions.
HeaderFnConfigs | |
|
Instances
Additional Data Types
data HeaderSyntax Source #
Syntax of the license header comment.
BlockComment Text Text | block (multi-line) comment syntax (e.g. |
LineComment Text | single line comment syntax (e.g. |
Instances
Eq HeaderSyntax Source # | |
Defined in Headroom.Configuration.Types (==) :: HeaderSyntax -> HeaderSyntax -> Bool # (/=) :: HeaderSyntax -> HeaderSyntax -> Bool # | |
Show HeaderSyntax Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> HeaderSyntax -> ShowS # show :: HeaderSyntax -> String # showList :: [HeaderSyntax] -> ShowS # |
Represents what action should the gen
command perform.
GenConfigFile | generate YAML config file stub |
GenLicense (LicenseType, FileType) | generate license header template |
Instances
data LicenseType Source #
Supported type of open source license.
Apache2 | support for Apache-2.0 license |
BSD3 | support for BSD-3-Clause license |
GPL2 | support for GNU GPL2 license |
GPL3 | support for GNU GPL3 license |
MIT | support for MIT license |
MPL2 | support for MPL2 license |
Instances
Represents what action should the run
command perform.
Add | add mode for |
Check | check mode for |
Drop | drop mode for |
Replace | replace mode for |
data TemplateSource Source #
Source of license templates
TemplateFiles [FilePath] | templates are stored as local files |
BuiltInTemplates LicenseType | use built-in templates for selected license |
Instances
Eq TemplateSource Source # | |
Defined in Headroom.Configuration.Types (==) :: TemplateSource -> TemplateSource -> Bool # (/=) :: TemplateSource -> TemplateSource -> Bool # | |
Show TemplateSource Source # | |
Defined in Headroom.Configuration.Types showsPrec :: Int -> TemplateSource -> ShowS # show :: TemplateSource -> String # showList :: [TemplateSource] -> ShowS # |