module Relude.Lifted.File
( readFile
, writeFile
, appendFile
, openFile
, hClose
) where
import Relude.Base (FilePath, Handle, IO, IOMode, String)
import Relude.Function ((.))
import Relude.Monad.Reexport (MonadIO (..))
import qualified System.IO as IO
readFile :: MonadIO m => FilePath -> m String
readFile = liftIO . IO.readFile
{-# SPECIALIZE readFile :: FilePath -> IO String #-}
{-# INLINE readFile #-}
writeFile :: MonadIO m => FilePath -> String -> m ()
writeFile p= liftIO . IO.writeFile p
{-# SPECIALIZE writeFile :: FilePath -> String -> IO () #-}
{-# INLINE writeFile #-}
appendFile :: MonadIO m => FilePath -> String -> m ()
appendFile p = liftIO . IO.appendFile p
{-# SPECIALIZE appendFile :: FilePath -> String -> IO () #-}
{-# INLINE appendFile #-}
openFile :: MonadIO m => FilePath -> IOMode -> m Handle
openFile p = liftIO . IO.openFile p
{-# SPECIALIZE openFile :: FilePath -> IOMode -> IO Handle #-}
{-# INLINE openFile #-}
hClose :: MonadIO m => Handle -> m ()
hClose = liftIO . hClose
{-# SPECIALIZE hClose :: Handle -> IO () #-}
{-# INLINE hClose #-}