{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-} module System.FilePath.FilePather.ByteString( fromFilePath , readFileB , writeFileB , appendFileB , module B ) where import Control.Exception ( Exception ) import Data.ByteString( ByteString ) import qualified Data.ByteString as B import System.FilePath.FilePather.ReadFilePath ( ReadFilePathT, tryReadFilePath ) import System.IO ( IO ) fromFilePath :: Exception e => ReadFilePathT e IO ByteString fromFilePath :: forall e. Exception e => ReadFilePathT e IO ByteString fromFilePath = forall e a. Exception e => (FilePath -> IO a) -> ReadFilePathT e IO a tryReadFilePath FilePath -> IO ByteString B.fromFilePath {-# INLINE fromFilePath #-} readFileB :: Exception e => ReadFilePathT e IO ByteString readFileB :: forall e. Exception e => ReadFilePathT e IO ByteString readFileB = forall e a. Exception e => (FilePath -> IO a) -> ReadFilePathT e IO a tryReadFilePath FilePath -> IO ByteString B.readFile {-# INLINE readFileB #-} writeFileB :: Exception e => ByteString -> ReadFilePathT e IO () writeFileB :: forall e. Exception e => ByteString -> ReadFilePathT e IO () writeFileB ByteString s = forall e a. Exception e => (FilePath -> IO a) -> ReadFilePathT e IO a tryReadFilePath (FilePath -> ByteString -> IO () `B.writeFile` ByteString s) {-# INLINE writeFileB #-} appendFileB :: Exception e => ByteString -> ReadFilePathT e IO () appendFileB :: forall e. Exception e => ByteString -> ReadFilePathT e IO () appendFileB ByteString s = forall e a. Exception e => (FilePath -> IO a) -> ReadFilePathT e IO a tryReadFilePath (FilePath -> ByteString -> IO () `B.appendFile` ByteString s) {-# INLINE appendFileB #-}