2010-12-25 19:18:36 +00:00
|
|
|
-- | Describes writable items; items that can be saved to the disk
|
|
|
|
--
|
2011-02-15 21:46:43 +00:00
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
2010-12-25 19:18:36 +00:00
|
|
|
module Hakyll.Core.Writable
|
|
|
|
( Writable (..)
|
|
|
|
) where
|
|
|
|
|
2011-01-04 12:09:45 +00:00
|
|
|
import Data.Word (Word8)
|
2010-12-30 12:49:58 +00:00
|
|
|
|
2011-01-04 12:09:45 +00:00
|
|
|
import qualified Data.ByteString as SB
|
2010-12-30 12:49:58 +00:00
|
|
|
|
2010-12-25 19:18:36 +00:00
|
|
|
-- | Describes an item that can be saved to the disk
|
|
|
|
--
|
|
|
|
class Writable a where
|
|
|
|
-- | Save an item to the given filepath
|
|
|
|
write :: FilePath -> a -> IO ()
|
|
|
|
|
|
|
|
instance Writable [Char] where
|
|
|
|
write = writeFile
|
2010-12-30 12:49:58 +00:00
|
|
|
|
2011-01-04 12:09:45 +00:00
|
|
|
instance Writable [Word8] where
|
|
|
|
write p = SB.writeFile p . SB.pack
|