on master help sign in
Binary/Typeable/Writable instances for Tags
c443d5cJasper Van der Jeugt
src/Hakyll/Web/Tags.hs+14−1
@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
1module Hakyll.Web.Tags
2module Hakyll.Web.Tags
2 ( Tags (..)
3 ( Tags (..)
3 , readTagsWith
4 , readTagsWith
@@ -5,17 +6,29 @@ module Hakyll.Web.Tags
5 , readCategories
6 , readCategories
6 ) where
7 ) where
7
8
9+import Control.Applicative ((<$>))
8import Data.Map (Map)
10import Data.Map (Map)
9import qualified Data.Map as M
11import qualified Data.Map as M
10
12
13+import Data.Typeable (Typeable)
14+import Data.Binary (Binary, get, put)
15+
11import Hakyll.Web.Page
16import Hakyll.Web.Page
12import Hakyll.Web.Util.String
17import Hakyll.Web.Util.String
18+import Hakyll.Core.Writable
13
19
14-- | Data about tags
20-- | Data about tags
15--
21--
16data Tags a = Tags
22data Tags a = Tags
17 { tagsMap :: Map String [Page a]
23 { tagsMap :: Map String [Page a]
18− } deriving (Show)
24+ } deriving (Show, Typeable)
25+
26+instance Binary a => Binary (Tags a) where
27+ get = Tags <$> get
28+ put (Tags m) = put m
29+
30+instance Writable (Tags a) where
31+ write _ _ = return ()
19
32
20-- | Higher-level function to read tags
33-- | Higher-level function to read tags
21--
34--