summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Writable.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-30 13:49:58 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-30 13:49:58 +0100
commit86fafe6e61f71428f933f62a3c68cb3819c189c9 (patch)
tree166f2e6fadd94c9d4158eba6ab163ae6359b4d54 /src/Hakyll/Core/Writable.hs
parent687c17c6bb1bc312a5660492164a9f00d710212a (diff)
downloadhakyll-86fafe6e61f71428f933f62a3c68cb3819c189c9.tar.gz
Add CopyFile newtype
Diffstat (limited to 'src/Hakyll/Core/Writable.hs')
-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