{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}
module Relude.Lifted.File
( readFile
#if ( __GLASGOW_HASKELL__ >= 900 )
, readFile'
#endif
, writeFile
, appendFile
) where
import Relude.Base (FilePath, IO)
import Relude.Function ((.))
import Relude.Monad.Reexport (MonadIO (..))
import Relude.String (String)
import qualified System.IO as IO
readFile :: MonadIO m => FilePath -> m String
readFile :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
readFile = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
IO.readFile
{-# SPECIALIZE readFile :: FilePath -> IO String #-}
{-# INLINE readFile #-}
{-# WARNING readFile ["'readFile' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileBS' or 'readFileLBS' instead."] #-}
#if ( __GLASGOW_HASKELL__ >= 900 )
readFile' :: MonadIO m => FilePath -> m String
readFile' :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
readFile' = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
IO.readFile'
{-# SPECIALIZE readFile' :: FilePath -> IO String #-}
{-# INLINE readFile' #-}
{-# WARNING readFile' ["readFile' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileBS' or 'readFileLBS' instead."] #-}
#endif
writeFile :: MonadIO m => FilePath -> String -> m ()
writeFile :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
writeFile FilePath
p= forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> FilePath -> IO ()
IO.writeFile FilePath
p
{-# SPECIALIZE writeFile :: FilePath -> String -> IO () #-}
{-# INLINE writeFile #-}
appendFile :: MonadIO m => FilePath -> String -> m ()
appendFile :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
appendFile FilePath
p = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> FilePath -> IO ()
IO.appendFile FilePath
p
{-# SPECIALIZE appendFile :: FilePath -> String -> IO () #-}
{-# INLINE appendFile #-}