summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Writable.hs
blob: a3fd421dbe0eda671abd99954010e31e3fdc6ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- | Describes writable items; items that can be saved to the disk
--
{-# LANGUAGE FlexibleInstances #-}
module Hakyll.Core.Writable
    ( Writable (..)
    ) where

import Data.Word (Word8)

import qualified Data.ByteString as SB

-- | 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

instance Writable [Word8] where
    write p = SB.writeFile p . SB.pack