summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Core/Writable.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Writable.hs b/src/Hakyll/Core/Writable.hs
index d6c3683..a93903f 100644
--- a/src/Hakyll/Core/Writable.hs
+++ b/src/Hakyll/Core/Writable.hs
@@ -1,10 +1,17 @@
-- | Describes writable items; items that can be saved to the disk
--
-{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving,
+ DeriveDataTypeable #-}
module Hakyll.Core.Writable
( Writable (..)
+ , CopyFile (..)
) where
+import System.Directory (copyFile)
+
+import Data.Binary (Binary)
+import Data.Typeable (Typeable)
+
-- | Describes an item that can be saved to the disk
--
class Writable a where
@@ -13,3 +20,11 @@ class Writable a where
instance Writable [Char] where
write = writeFile
+
+-- | Newtype construct around 'FilePath' which will copy the file directly
+--
+newtype CopyFile = CopyFile {unCopyFile :: FilePath}
+ deriving (Show, Eq, Ord, Binary, Typeable)
+
+instance Writable CopyFile where
+ write dst (CopyFile src) = copyFile src dst