diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-30 13:49:58 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-30 13:49:58 +0100 |
commit | 86fafe6e61f71428f933f62a3c68cb3819c189c9 (patch) | |
tree | 166f2e6fadd94c9d4158eba6ab163ae6359b4d54 /src/Hakyll | |
parent | 687c17c6bb1bc312a5660492164a9f00d710212a (diff) | |
download | hakyll-86fafe6e61f71428f933f62a3c68cb3819c189c9.tar.gz |
Add CopyFile newtype
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Core/Writable.hs | 17 |
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 |