<commit_before>-- | Describes writable items; items that can be saved to the disk
--
{-# LANGUAGE FlexibleInstances #-}
module Hakyll.Core.Writable
    ( Writable (..)
    ) where

-- | 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<commit_msg>Add CopyFile newtype<commit_after>-- | Describes writable items; items that can be saved to the disk
--
{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving,
        DeriveDataTypeable #-}
module Hakyll.Core.Writable
    ( Writable (..)
    , CopyFile (..)
    ) where

import System.Directory (copyFile)

import Data.Binary (Binary)
import Data.Typeable (Typeable)

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

-- | Newtype construct around 'FilePath' which will copy the file directly
--
newtype CopyFile = CopyFile {unCopyFile :: FilePath}
                 deriving (Show, Eq, Ord, Binary, Typeable)

instance Writable CopyFile where
    write dst (CopyFile src) = copyFile src dst
{'fraction_non_alphanumeric': 0.09572784810126582, 'fraction_numerical': 0.0, 'mean_word_length': 3.067524115755627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3280231', 'n_tokens_mistral': 382, 'n_tokens_neox': 379, 'n_words': 143}