on 86ede74 help sign in
36 lines 1.3 kB history raw
1--------------------------------------------------------------------------------
2-- | Exports simple compilers to just copy files
3{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
4module Hakyll.Core.Writable.CopyFile
5 ( CopyFile (..)
6 , copyFileCompiler
7 ) where
10--------------------------------------------------------------------------------
11import Control.Arrow ((>>^))
12import System.Directory (copyFile)
13import Data.Typeable (Typeable)
14import Data.Binary (Binary)
17--------------------------------------------------------------------------------
18import Hakyll.Core.Writable
19import Hakyll.Core.Compiler
20import Hakyll.Core.Identifier
23--------------------------------------------------------------------------------
24-- | Newtype construct around 'FilePath' which will copy the file directly
25newtype CopyFile = CopyFile {unCopyFile :: FilePath}
26 deriving (Show, Eq, Ord, Binary, Typeable)
29--------------------------------------------------------------------------------
30instance Writable CopyFile where
31 write dst (CopyFile src) = copyFile src dst
34--------------------------------------------------------------------------------
35copyFileCompiler :: Compiler a CopyFile
36copyFileCompiler = getIdentifier >>^ CopyFile . toFilePath