{-| Defines the template types used internally in ProjectForge -} module ProjectForge.ProjectTemplate where import Data.Set (Set) import Text.Mustache (Template) {-| A @FileTemplate@ is a pair of @'Text.Mustache.Template'@s: one for a file's name and one for a file's contents. See @'ProjectForge.Compile.compileFileTemplate`@ for a utility to create a @FileTemplate@ from text inputs. -} data FileTemplate = MkFileTemplate { originalFilename :: !FilePath -- ^ name of the template file , fileNameTemplate :: !Template -- ^ template for a file's name , fileContentsTemplate :: !Template -- ^ template for contents of a file } deriving (Eq, Show, Ord) {-| A collection of @'FileTemplate'@ corresponding to all the files to be produced by an initialization template. -} newtype ProjectTemplate = MkProjectTemplate (Set FileTemplate) deriving (Eq, Show) instance Semigroup ProjectTemplate where (<>) (MkProjectTemplate x) (MkProjectTemplate y) = MkProjectTemplate (x <> y)