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