on 547030f help sign in
37 lines 1.4 kB history raw
1--------------------------------------------------------------------------------
2-- | Exports simple compilers to just copy files
3{-# LANGUAGE DeriveDataTypeable #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5module Hakyll.Core.Writable.CopyFile
6 ( CopyFile (..)
7 , copyFileCompiler
8 ) where
11--------------------------------------------------------------------------------
12import Control.Applicative ((<$>))
13import Data.Binary (Binary)
14import Data.Typeable (Typeable)
15import System.Directory (copyFile)
18--------------------------------------------------------------------------------
19import Hakyll.Core.Compiler
20import Hakyll.Core.Identifier
21import Hakyll.Core.Writable
24--------------------------------------------------------------------------------
25-- | Newtype construct around 'FilePath' which will copy the file directly
26newtype CopyFile = CopyFile {unCopyFile :: FilePath}
27 deriving (Show, Eq, Ord, Binary, Typeable)
30--------------------------------------------------------------------------------
31instance Writable CopyFile where
32 write dst (CopyFile src) = copyFile src dst
35--------------------------------------------------------------------------------
36copyFileCompiler :: Compiler CopyFile
37copyFileCompiler = CopyFile . toFilePath <$> getIdentifier