@@ -1,10 +1,17 @@
11-- | Describes writable items; items that can be saved to the disk
22--
3−{-# LANGUAGE FlexibleInstances #-}
3+{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving,
4+ DeriveDataTypeable #-}
45module Hakyll.Core.Writable
56 ( Writable (..)
7+ , CopyFile (..)
68 ) where
79
10+import System.Directory (copyFile)
11+
12+import Data.Binary (Binary)
13+import Data.Typeable (Typeable)
14+
815-- | Describes an item that can be saved to the disk
916--
1017class Writable a where
@@ -13,3 +20,11 @@ class Writable a where
1320
1421instance Writable [Char] where
1522 write = writeFile
23+
24+-- | Newtype construct around 'FilePath' which will copy the file directly
25+--
26+newtype CopyFile = CopyFile {unCopyFile :: FilePath}
27+ deriving (Show, Eq, Ord, Binary, Typeable)
28+
29+instance Writable CopyFile where
30+ write dst (CopyFile src) = copyFile src dst