diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-01-18 23:57:58 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-01-18 23:57:58 +0100 |
commit | f104f91182a0850a9432b3a8c79849034220557b (patch) | |
tree | d58d7974776fda0f2ba4449c15aaf66f3d9c93a1 /src/Hakyll/Web/Page/Internal.hs | |
parent | 0bbc01f0128f0c9e0a217f1d33f876ab03d29905 (diff) | |
download | hakyll-f104f91182a0850a9432b3a8c79849034220557b.tar.gz |
Monoid instance for page
Diffstat (limited to 'src/Hakyll/Web/Page/Internal.hs')
-rw-r--r-- | src/Hakyll/Web/Page/Internal.hs | 7 |
1 files changed, 7 insertions, 0 deletions
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) |