diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-18 21:56:52 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-18 21:56:52 +0100 |
commit | 877cb21d1630d32c6e40eb7c6f0ecc7e1da2bd52 (patch) | |
tree | 57ce11325adbbb7502086450dd1d1a9f1e81b8f2 /src/Hakyll/Core/Writable | |
parent | 1347b0fa6cdd98986f927368e76e849068f69e1a (diff) | |
download | hakyll-877cb21d1630d32c6e40eb7c6f0ecc7e1da2bd52.tar.gz |
Add Item abstraction
Diffstat (limited to 'src/Hakyll/Core/Writable')
-rw-r--r-- | src/Hakyll/Core/Writable/CopyFile.hs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/Hakyll/Core/Writable/CopyFile.hs b/src/Hakyll/Core/Writable/CopyFile.hs index 2d92891..58397ac 100644 --- a/src/Hakyll/Core/Writable/CopyFile.hs +++ b/src/Hakyll/Core/Writable/CopyFile.hs @@ -9,8 +9,7 @@ module Hakyll.Core.Writable.CopyFile -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) -import Data.Binary (Binary) +import Data.Binary (Binary (..)) import Data.Typeable (Typeable) import System.Directory (copyFile) @@ -18,20 +17,27 @@ import System.Directory (copyFile) -------------------------------------------------------------------------------- import Hakyll.Core.Compiler import Hakyll.Core.Identifier +import Hakyll.Core.Item import Hakyll.Core.Writable -------------------------------------------------------------------------------- --- | Newtype construct around 'FilePath' which will copy the file directly -newtype CopyFile = CopyFile {unCopyFile :: FilePath} - deriving (Show, Eq, Ord, Binary, Typeable) +-- | This will copy any file directly by using a system call +data CopyFile = CopyFile + deriving (Show, Eq, Ord, Typeable) + + +-------------------------------------------------------------------------------- +instance Binary CopyFile where + put CopyFile = return () + get = return CopyFile -------------------------------------------------------------------------------- instance Writable CopyFile where - write dst (CopyFile src) = copyFile src dst + write dst item = copyFile (toFilePath $ itemIdentifier item) dst -------------------------------------------------------------------------------- -copyFileCompiler :: Compiler CopyFile -copyFileCompiler = CopyFile . toFilePath <$> getIdentifier +copyFileCompiler :: Compiler (Item CopyFile) +copyFileCompiler = makeItem CopyFile |