1-- | This module exposes a writable type 'WritableTuple' which is a simple
2-- newtype wrapper around a tuple.
4-- The idea is that, given a tuple @(a, b)@, @a@ is the value you actually want
5-- to save to the disk, and @b@ is some additional info that you /don't/ want to
6-- save, but that you need later, for example in a 'require' clause.
8{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
9module Hakyll.Core.Writable.WritableTuple
13 , writableTupleCompiler
16import Control.Arrow (arr)
18import Data.Typeable (Typeable)
19import Data.Binary (Binary)
21import Hakyll.Core.Writable
22import Hakyll.Core.Compiler
24newtype WritableTuple a b = WritableTuple {unWritableTuple :: (a, b)}
25 deriving (Show, Eq, Ord, Binary, Typeable)
27instance Writable a => Writable (WritableTuple a b) where
28 write dst (WritableTuple (x, _)) = write dst x
30writableTupleFst :: WritableTuple a b -> a
31writableTupleFst = fst . unWritableTuple
33writableTupleSnd :: WritableTuple a b -> b
34writableTupleSnd = snd . unWritableTuple
36writableTupleCompiler :: Compiler (a, b) (WritableTuple a b)
37writableTupleCompiler = arr WritableTuple
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list