From 8d2e834cf587b41f70dc04b0e26b0cd35b31a6c4 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Tue, 15 Nov 2016 07:25:54 -0500 Subject: [PATCH] Add monoid instance for Cell --- yesod-colonnade/src/Yesod/Colonnade.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yesod-colonnade/src/Yesod/Colonnade.hs b/yesod-colonnade/src/Yesod/Colonnade.hs index 609ed99..f7dc58b 100644 --- a/yesod-colonnade/src/Yesod/Colonnade.hs +++ b/yesod-colonnade/src/Yesod/Colonnade.hs @@ -15,6 +15,7 @@ import Yesod.Core import Colonnade.Types import Data.Text (Text) import Control.Monad +import Data.Monoid import Data.String (IsString(..)) import qualified Colonnade.Encoding as Encoding import qualified Data.Text.Lazy as LText @@ -28,6 +29,10 @@ data Cell site = Cell instance IsString (Cell site) where fromString = stringCell +instance Monoid (Cell site) where + mempty = Cell [] mempty + mappend (Cell a1 c1) (Cell a2 c2) = Cell (mappend a1 a2) (mappend c1 c2) + cell :: WidgetT site IO () -> Cell site cell = Cell []