From f104f91182a0850a9432b3a8c79849034220557b Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 18 Jan 2011 23:57:58 +0100 Subject: Monoid instance for page --- src/Hakyll/Web/Page/Internal.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Hakyll/Web/Page/Internal.hs') diff --git a/src/Hakyll/Web/Page/Internal.hs b/src/Hakyll/Web/Page/Internal.hs index bac4c51..3192141 100644 --- a/src/Hakyll/Web/Page/Internal.hs +++ b/src/Hakyll/Web/Page/Internal.hs @@ -6,10 +6,12 @@ module Hakyll.Web.Page.Internal ) where import Control.Applicative ((<$>), (<*>)) +import Data.Monoid (Monoid, mempty, mappend) import Data.Map (Map) import Data.Binary (Binary, get, put) import Data.Typeable (Typeable) +import qualified Data.Map as M import Hakyll.Core.Writable @@ -20,6 +22,11 @@ data Page a = Page , pageBody :: a } deriving (Show, Typeable) +instance Monoid a => Monoid (Page a) where + mempty = Page M.empty mempty + mappend (Page m1 b1) (Page m2 b2) = + Page (M.union m1 m2) (mappend b1 b2) + instance Functor Page where fmap f (Page m b) = Page m (f b) -- cgit v1.2.3