module Magic.FilePath
( module Magic
, magicFile
, magicLoad
, magicCompile
, magicCheck
, magicGetPath
) where
import Magic hiding (magicFile, magicLoad, magicCompile, magicCheck, magicGetPath)
import qualified Magic as O
import Data.Text (Text)
import System.OsPath (decodeFS, encodeFS)
magicFile :: Magic -> FilePath -> IO Text
magicFile :: Magic -> FilePath -> IO Text
magicFile Magic
m FilePath
p = Magic -> OsPath -> IO Text
O.magicFile Magic
m (OsPath -> IO Text) -> IO OsPath -> IO Text
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< FilePath -> IO OsPath
encodeFS FilePath
p
magicLoad :: Magic -> [FilePath] -> IO ()
magicLoad :: Magic -> [FilePath] -> IO ()
magicLoad Magic
m [FilePath]
ps = Magic -> [OsPath] -> IO ()
O.magicLoad Magic
m ([OsPath] -> IO ()) -> IO [OsPath] -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (FilePath -> IO OsPath) -> [FilePath] -> IO [OsPath]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM FilePath -> IO OsPath
encodeFS [FilePath]
ps
magicCompile :: Magic -> [FilePath] -> IO ()
magicCompile :: Magic -> [FilePath] -> IO ()
magicCompile Magic
m [FilePath]
ps = Magic -> [OsPath] -> IO ()
O.magicCompile Magic
m ([OsPath] -> IO ()) -> IO [OsPath] -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (FilePath -> IO OsPath) -> [FilePath] -> IO [OsPath]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM FilePath -> IO OsPath
encodeFS [FilePath]
ps
magicCheck :: Magic -> [FilePath] -> IO Bool
magicCheck :: Magic -> [FilePath] -> IO Bool
magicCheck Magic
m [FilePath]
ps = Magic -> [OsPath] -> IO Bool
O.magicCheck Magic
m ([OsPath] -> IO Bool) -> IO [OsPath] -> IO Bool
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< (FilePath -> IO OsPath) -> [FilePath] -> IO [OsPath]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM FilePath -> IO OsPath
encodeFS [FilePath]
ps
magicGetPath :: IO [FilePath]
magicGetPath :: IO [FilePath]
magicGetPath = IO [OsPath]
O.magicGetPath IO [OsPath] -> ([OsPath] -> IO [FilePath]) -> IO [FilePath]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (OsPath -> IO FilePath) -> [OsPath] -> IO [FilePath]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM OsPath -> IO FilePath
decodeFS