A configuration is structured application data that supplies a file-synchronization program with source and destination paths, an optional file-type restriction, and optional recursion and transfer limits. section 15.1.1
Listing 15.1 A type for configuring the file synchronization application
module App.Types where
import System.FileType (FileType) #1
data Config = Config
{ configFromPath :: FilePath, #2
configToPath :: FilePath, #2
configRequiredFileType :: Maybe FileType, #3
configMaxRecursionDepth :: Maybe Int, #4
configMaxTransferredFiles :: Maybe Int #4
}
deriving (Show, Eq)
The Config record groups paths, an optional FileType, and optional Int bounds into one value that actions can read. section 15.1.1
Use configuration in two stages:
- Pass Config explicitly to actions when direct access is sufficient, using record pattern matching to expose its fields. section 15.1.1
- Use ReaderT Config IO when many actions need the same read-only environment; run the application with runReaderT and lift ordinary IO operations. section 15.1.1
- Keep configuration distinct from mutable synchronization state and accumulated file reports, which require different data interactions. section 15.1






















