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