summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-15 22:46:43 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-15 22:46:43 +0100
commita5438d8d9284ba2855934fc13f318c8f2dff6db9 (patch)
treeaf3d3f2a23a5de1d092189fba85fa854df93f998 /src
parent28a30caef08ab786bfa8b75d75f155a4e62b7280 (diff)
downloadhakyll-a5438d8d9284ba2855934fc13f318c8f2dff6db9.tar.gz
defaultCopyFile → copyFileCompiler
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll.hs2
-rw-r--r--src/Hakyll/Core/CopyFile.hs29
-rw-r--r--src/Hakyll/Core/Writable.hs15
-rw-r--r--src/Hakyll/Web.hs6
4 files changed, 33 insertions, 19 deletions
diff --git a/src/Hakyll.hs b/src/Hakyll.hs
index 64d5330..aaf36d4 100644
--- a/src/Hakyll.hs
+++ b/src/Hakyll.hs
@@ -2,6 +2,7 @@
--
module Hakyll
( module Hakyll.Core.Compiler
+ , module Hakyll.Core.CopyFile
, module Hakyll.Core.Configuration
, module Hakyll.Core.Identifier
, module Hakyll.Core.Identifier.Pattern
@@ -26,6 +27,7 @@ module Hakyll
) where
import Hakyll.Core.Compiler
+import Hakyll.Core.CopyFile
import Hakyll.Core.Configuration
import Hakyll.Core.Identifier
import Hakyll.Core.Identifier.Pattern
diff --git a/src/Hakyll/Core/CopyFile.hs b/src/Hakyll/Core/CopyFile.hs
new file mode 100644
index 0000000..dbbaaa1
--- /dev/null
+++ b/src/Hakyll/Core/CopyFile.hs
@@ -0,0 +1,29 @@
+-- | Exports simple compilers to just copy files
+--
+{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
+module Hakyll.Core.CopyFile
+ ( CopyFile (..)
+ , copyFileCompiler
+ ) where
+
+import Control.Arrow ((>>^))
+import System.Directory (copyFile)
+
+import Data.Typeable (Typeable)
+import Data.Binary (Binary)
+
+import Hakyll.Core.ResourceProvider
+import Hakyll.Core.Writable
+import Hakyll.Core.Compiler
+import Hakyll.Core.Identifier
+
+-- | 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
+
+copyFileCompiler :: Compiler Resource CopyFile
+copyFileCompiler = getIdentifier >>^ CopyFile . toFilePath
diff --git a/src/Hakyll/Core/Writable.hs b/src/Hakyll/Core/Writable.hs
index db53d9a..a3fd421 100644
--- a/src/Hakyll/Core/Writable.hs
+++ b/src/Hakyll/Core/Writable.hs
@@ -1,18 +1,13 @@
-- | Describes writable items; items that can be saved to the disk
--
-{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving,
- DeriveDataTypeable #-}
+{-# LANGUAGE FlexibleInstances #-}
module Hakyll.Core.Writable
( Writable (..)
- , CopyFile (..)
) where
-import System.Directory (copyFile)
import Data.Word (Word8)
import qualified Data.ByteString as SB
-import Data.Binary (Binary)
-import Data.Typeable (Typeable)
-- | Describes an item that can be saved to the disk
--
@@ -25,11 +20,3 @@ instance Writable [Char] where
instance Writable [Word8] where
write p = SB.writeFile p . SB.pack
-
--- | 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
diff --git a/src/Hakyll/Web.hs b/src/Hakyll/Web.hs
index ec05afb..482cf6d 100644
--- a/src/Hakyll/Web.hs
+++ b/src/Hakyll/Web.hs
@@ -1,8 +1,7 @@
-- | Module exporting commonly used web-related functions
--
module Hakyll.Web
- ( defaultCopyFile
- , defaultApplyTemplate
+ ( defaultApplyTemplate
) where
import Control.Arrow ((>>^))
@@ -14,9 +13,6 @@ import Hakyll.Core.ResourceProvider
import Hakyll.Web.Page
import Hakyll.Web.Template
-defaultCopyFile :: Compiler Resource CopyFile
-defaultCopyFile = getIdentifier >>^ CopyFile . toFilePath
-
defaultApplyTemplate :: Identifier -- ^ Template
-> Compiler (Page String) (Page String) -- ^ Compiler
defaultApplyTemplate identifier = require identifier (flip applyTemplate)