summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Writable
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-11-13 17:31:03 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-11-13 17:31:03 +0100
commitf0af2a3b79ea7eea3f521f79fd903f9023ec85df (patch)
treebbc460b65ab52879c616dffce1bb32fe8d8df2ac /src/Hakyll/Core/Writable
parentd2e913f42434841c584b97ae9d5417ff2737c0ce (diff)
downloadhakyll-f0af2a3b79ea7eea3f521f79fd903f9023ec85df.tar.gz
WIP
Diffstat (limited to 'src/Hakyll/Core/Writable')
-rw-r--r--src/Hakyll/Core/Writable/CopyFile.hs21
-rw-r--r--src/Hakyll/Core/Writable/WritableTuple.hs37
2 files changed, 11 insertions, 47 deletions
diff --git a/src/Hakyll/Core/Writable/CopyFile.hs b/src/Hakyll/Core/Writable/CopyFile.hs
index 6cc08f2..2d92891 100644
--- a/src/Hakyll/Core/Writable/CopyFile.hs
+++ b/src/Hakyll/Core/Writable/CopyFile.hs
@@ -1,6 +1,7 @@
--------------------------------------------------------------------------------
-- | Exports simple compilers to just copy files
-{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hakyll.Core.Writable.CopyFile
( CopyFile (..)
, copyFileCompiler
@@ -8,16 +9,16 @@ module Hakyll.Core.Writable.CopyFile
--------------------------------------------------------------------------------
-import Control.Arrow ((>>^))
-import System.Directory (copyFile)
-import Data.Typeable (Typeable)
-import Data.Binary (Binary)
+import Control.Applicative ((<$>))
+import Data.Binary (Binary)
+import Data.Typeable (Typeable)
+import System.Directory (copyFile)
--------------------------------------------------------------------------------
-import Hakyll.Core.Writable
-import Hakyll.Core.Compiler
-import Hakyll.Core.Identifier
+import Hakyll.Core.Compiler
+import Hakyll.Core.Identifier
+import Hakyll.Core.Writable
--------------------------------------------------------------------------------
@@ -32,5 +33,5 @@ instance Writable CopyFile where
--------------------------------------------------------------------------------
-copyFileCompiler :: Compiler a CopyFile
-copyFileCompiler = getIdentifier >>^ CopyFile . toFilePath
+copyFileCompiler :: Compiler CopyFile
+copyFileCompiler = CopyFile . toFilePath <$> getIdentifier
diff --git a/src/Hakyll/Core/Writable/WritableTuple.hs b/src/Hakyll/Core/Writable/WritableTuple.hs
deleted file mode 100644
index 741d2c7..0000000
--- a/src/Hakyll/Core/Writable/WritableTuple.hs
+++ /dev/null
@@ -1,37 +0,0 @@
--- | This module exposes a writable type 'WritableTuple' which is a simple
--- newtype wrapper around a tuple.
---
--- The idea is that, given a tuple @(a, b)@, @a@ is the value you actually want
--- to save to the disk, and @b@ is some additional info that you /don't/ want to
--- save, but that you need later, for example in a 'require' clause.
---
-{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
-module Hakyll.Core.Writable.WritableTuple
- ( WritableTuple (..)
- , writableTupleFst
- , writableTupleSnd
- , writableTupleCompiler
- ) where
-
-import Control.Arrow (arr)
-
-import Data.Typeable (Typeable)
-import Data.Binary (Binary)
-
-import Hakyll.Core.Writable
-import Hakyll.Core.Compiler
-
-newtype WritableTuple a b = WritableTuple {unWritableTuple :: (a, b)}
- deriving (Show, Eq, Ord, Binary, Typeable)
-
-instance Writable a => Writable (WritableTuple a b) where
- write dst (WritableTuple (x, _)) = write dst x
-
-writableTupleFst :: WritableTuple a b -> a
-writableTupleFst = fst . unWritableTuple
-
-writableTupleSnd :: WritableTuple a b -> b
-writableTupleSnd = snd . unWritableTuple
-
-writableTupleCompiler :: Compiler (a, b) (WritableTuple a b)
-writableTupleCompiler = arr WritableTuple