Monoid instance for page
This commit is contained in:
parent
0bbc01f012
commit
f104f91182
1 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue