diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-15 22:46:43 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-15 22:46:43 +0100 |
commit | a5438d8d9284ba2855934fc13f318c8f2dff6db9 (patch) | |
tree | af3d3f2a23a5de1d092189fba85fa854df93f998 /src/Hakyll/Core/CopyFile.hs | |
parent | 28a30caef08ab786bfa8b75d75f155a4e62b7280 (diff) | |
download | hakyll-a5438d8d9284ba2855934fc13f318c8f2dff6db9.tar.gz |
defaultCopyFile → copyFileCompiler
Diffstat (limited to 'src/Hakyll/Core/CopyFile.hs')
-rw-r--r-- | src/Hakyll/Core/CopyFile.hs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Hakyll/Core/CopyFile.hs b/src/Hakyll/Core/CopyFile.hs new file mode 100644 index 0000000..dbbaaa1 --- /dev/null +++ b/src/Hakyll/Core/CopyFile.hs @@ -0,0 +1,29 @@ +-- | Exports simple compilers to just copy files +-- +{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-} +module Hakyll.Core.CopyFile + ( CopyFile (..) + , copyFileCompiler + ) where + +import Control.Arrow ((>>^)) +import System.Directory (copyFile) + +import Data.Typeable (Typeable) +import Data.Binary (Binary) + +import Hakyll.Core.ResourceProvider +import Hakyll.Core.Writable +import Hakyll.Core.Compiler +import Hakyll.Core.Identifier + +-- | Newtype construct around 'FilePath' which will copy the file directly +-- +newtype CopyFile = CopyFile {unCopyFile :: FilePath} + deriving (Show, Eq, Ord, Binary, Typeable) + +instance Writable CopyFile where + write dst (CopyFile src) = copyFile src dst + +copyFileCompiler :: Compiler Resource CopyFile +copyFileCompiler = getIdentifier >>^ CopyFile . toFilePath |