From be685e6fcdbdb8d1bf49a09212413922a2e1ea82 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 4 Mar 2011 11:46:06 +0100 Subject: Add BlazeHtml integration --- src/Hakyll/Core/Writable.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Hakyll/Core') diff --git a/src/Hakyll/Core/Writable.hs b/src/Hakyll/Core/Writable.hs index a3fd421..1253e19 100644 --- a/src/Hakyll/Core/Writable.hs +++ b/src/Hakyll/Core/Writable.hs @@ -1,6 +1,6 @@ -- | Describes writable items; items that can be saved to the disk -- -{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} module Hakyll.Core.Writable ( Writable (..) ) where @@ -8,6 +8,8 @@ module Hakyll.Core.Writable import Data.Word (Word8) import qualified Data.ByteString as SB +import Text.Blaze (Html) +import Text.Blaze.Renderer.String (renderHtml) -- | Describes an item that can be saved to the disk -- @@ -18,5 +20,11 @@ class Writable a where instance Writable [Char] where write = writeFile +instance Writable SB.ByteString where + write p = SB.writeFile p + instance Writable [Word8] where - write p = SB.writeFile p . SB.pack + write p = write p . SB.pack + +instance Writable Html where + write p html = write p $ renderHtml html -- cgit v1.2.3