SKAT engine
Safe HaskellNone

Config

Description

Contains metadata for the application as well as values needed for SKAT to run.

Synopsis

Documentation

data Dotfile #

It represents the data coming from the configuration file. More data can be needed but may not be configurable. The Dotfile is used to create a GenConfig which will be used by the application.

Constructors

Dotfile 

Fields

  • templates' :: Last RelDir

    Templates directory path relative to the root.

  • output' :: Last (Map String RelDir)

    Configuration for the output. Keys are matched on the names of the templates, the values are relative directory paths inside the root.

  • filenameSeparator' :: Last (Maybe Char)

    Character used to separate the template filename and make use of suffix.

Instances

Instances details
Show Dotfile # 
Instance details

Defined in Config

Methods

showsPrec :: Int -> Dotfile -> ShowS

show :: Dotfile -> String

showList :: [Dotfile] -> ShowS

Generic Dotfile # 
Instance details

Defined in Config

Associated Types

type Rep Dotfile :: Type -> Type

Methods

from :: Dotfile -> Rep Dotfile x

to :: Rep Dotfile x -> Dotfile

Semigroup Dotfile # 
Instance details

Defined in Config

Methods

(<>) :: Dotfile -> Dotfile -> Dotfile

sconcat :: NonEmpty Dotfile -> Dotfile

stimes :: Integral b => b -> Dotfile -> Dotfile

FromJSON Dotfile # 
Instance details

Defined in Config

Methods

parseJSON :: Value -> Parser Dotfile

parseJSONList :: Value -> Parser [Dotfile]

type Rep Dotfile # 
Instance details

Defined in Config

type Rep Dotfile = D1 ('MetaData "Dotfile" "Config" "main" 'False) (C1 ('MetaCons "Dotfile" 'PrefixI 'True) (S1 ('MetaSel ('Just "templates'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Last RelDir)) :*: (S1 ('MetaSel ('Just "output'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Last (Map String RelDir))) :*: S1 ('MetaSel ('Just "filenameSeparator'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Last (Maybe Char))))))

data ConfigError #

Encompasses all possible errors in the Config module

Constructors

CouldNotMakeConfig String

Cannot create a valid config from all inputs

InvalidOutputMap String

Output map has invalid values

DuplicateOutputMapError String

Output map has duplicated values

InvalidOutputPath String

Output value is not a valid RelPath

Instances

Instances details
Show ConfigError # 
Instance details

Defined in Config

Methods

showsPrec :: Int -> ConfigError -> ShowS

show :: ConfigError -> String

showList :: [ConfigError] -> ShowS

handleConfigResult :: Maybe GenConfig -> Either ConfigError GenConfig #

Transform maybe config to an Either of the correct Domain error or the valid Config

mkDirPath :: (String -> Dir os) -> Text -> Last (Dir os) #

mkOutputDirs :: Map String String -> Last (Map String RelDir) #

data GenConfig #

This is the configuration used by the application wtih all the metadata needed to generate code.

Constructors

GenConfig 

Fields

  • templatesDir :: RelDir

    Templates directory path relative to the root.

  • outputDirs :: Map String RelDir

    Configuration for the output. Keys are matched on the names of the templates, the values are relative directory paths inside the root.

  • separator :: Maybe Char

    Character used to separate the template filename and make use of suffix.

Instances

Instances details
Eq GenConfig # 
Instance details

Defined in Config

Methods

(==) :: GenConfig -> GenConfig -> Bool

(/=) :: GenConfig -> GenConfig -> Bool

Show GenConfig # 
Instance details

Defined in Config

Methods

showsPrec :: Int -> GenConfig -> ShowS

show :: GenConfig -> String

showList :: [GenConfig] -> ShowS

dotfileName :: String #

Name for the dotfile where the configuration will be read from

decodeConfig :: String -> Dotfile #

mkDotfile #

Arguments

:: Last RelDir

Templates directory path relative to the root.

-> Last (Map String RelDir)

Configuration for the output. Keys are matched on the names of the templates, the values are relative directory paths inside the root.

-> Last (Maybe Char)

Character used to separate the template filename and make use of suffix.

-> Dotfile 

Factory function for constructing a Dotfile

mkConfig :: Dotfile -> String -> Maybe GenConfig #

Factory to make a GenConfig from a JSONString. It will attempt to construct a Dotfile from its values and then combine it with a default config. The result will be the GenConfig that will be returned.

>>> mkConfig "{ \"root\": \"/dummy/project\", \"templates\": \".skat/templates\", \"filenameSeparator\": \".\", \"output\": { \"component\": \"./components\" }}"

data InitDotfile #

Constructors

InitDotfile 

Fields

Instances

Instances details
Show InitDotfile # 
Instance details

Defined in Config

Methods

showsPrec :: Int -> InitDotfile -> ShowS

show :: InitDotfile -> String

showList :: [InitDotfile] -> ShowS

data InitDotfileSerializable #

Constructors

InitDotfileSerializable 

Fields

Instances

Instances details
Show InitDotfileSerializable # 
Instance details

Defined in Config

Generic InitDotfileSerializable # 
Instance details

Defined in Config

Associated Types

type Rep InitDotfileSerializable :: Type -> Type

ToJSON InitDotfileSerializable # 
Instance details

Defined in Config

type Rep InitDotfileSerializable # 
Instance details

Defined in Config

type Rep InitDotfileSerializable = D1 ('MetaData "InitDotfileSerializable" "Config" "main" 'False) (C1 ('MetaCons "InitDotfileSerializable" 'PrefixI 'True) (S1 ('MetaSel ('Just "templates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "output") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String String)) :*: S1 ('MetaSel ('Just "filenameSeparator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

mkInitDotfile :: RelDir -> Map String RelDir -> Maybe Char -> InitDotfile #

parseTemplatesPath :: String -> Maybe RelDir #

mkDuplicateOutputMapError :: (String, String) -> Map String String -> ConfigError #

parseOutputMap :: String -> Maybe (Map String RelDir) #

parseSeparator :: String -> Maybe (Maybe Char) #