on 5cc710d help sign in
29 lines 838 B history raw
1-- | Exports simple compilers to just copy files
2--
3{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
4module Hakyll.Core.Writable.CopyFile
5 ( CopyFile (..)
6 , copyFileCompiler
7 ) where
9import Control.Arrow ((>>^))
10import System.Directory (copyFile)
12import Data.Typeable (Typeable)
13import Data.Binary (Binary)
15import Hakyll.Core.ResourceProvider
16import Hakyll.Core.Writable
17import Hakyll.Core.Compiler
18import Hakyll.Core.Identifier
20-- | Newtype construct around 'FilePath' which will copy the file directly
21--
22newtype CopyFile = CopyFile {unCopyFile :: FilePath}
23 deriving (Show, Eq, Ord, Binary, Typeable)
25instance Writable CopyFile where
26 write dst (CopyFile src) = copyFile src dst
28copyFileCompiler :: Compiler Resource CopyFile
29copyFileCompiler = getIdentifier >>^ CopyFile . toFilePath