packages feed

shake-plus 0.1.10.0 → 0.2.0.0

raw patch · 17 files changed

+217/−111 lines, 17 filesdep +path-likedep ~withinsetup-changedPVP ok

version bump matches the API change (PVP)

Dependencies added: path-like

Dependency ranges changed: within

API changes (from Hackage documentation)

- Development.Shake.Plus.File: copyFileChangedWithin :: (MonadAction m, Partial) => Within Rel (Path Rel File) -> Within Rel (Path Rel File) -> m ()
- Development.Shake.Plus.File: copyFileWithin' :: (MonadAction m, Partial) => Within Rel (Path Rel File) -> Within Rel (Path Rel File) -> m ()
- Development.Shake.Plus.File: readFileWithin :: MonadAction m => Within Rel (Path Rel File) -> m Text
- Development.Shake.Plus.File: writeFileChangedWithin :: MonadAction m => Within Rel (Path Rel File) -> Text -> m ()
- Development.Shake.Plus.File: writeFileWithin :: MonadAction m => Within Rel (Path Rel File) -> Text -> m ()
- Development.Shake.Plus.FileRules: needInFP :: (Partial, MonadAction m, Traversable t) => Path b Dir -> t FilePattern -> m ()
- Development.Shake.Plus.FileRules: needWithin' :: (Partial, MonadAction m, Traversable t) => t (Within b (Path Rel File)) -> m ()
- Development.Shake.Plus.FileRules: wantInFP :: (Partial, MonadRules m, Traversable t) => Path b Dir -> t FilePattern -> m ()
- Development.Shake.Plus.FileRules: wantWithin' :: (Partial, MonadRules m, Traversable t) => t (Within b (Path Rel File)) -> m ()
+ Development.Shake.Plus.File: (/>) :: (DirLike b a, FileLike Rel c) => a -> c -> Path b File
+ Development.Shake.Plus.File: class PathLike b Dir a => DirLike b a
+ Development.Shake.Plus.File: class PathLike b File a => FileLike b a
+ Development.Shake.Plus.File: copyFile :: (MonadAction m, FileLike b a, FileLike b' a', Partial) => a -> a' -> m ()
+ Development.Shake.Plus.File: copyFileChanged' :: (MonadAction m, FileLike b a, Partial) => a -> a -> m ()
+ Development.Shake.Plus.File: toDir :: DirLike b a => a -> Path b Dir
+ Development.Shake.Plus.File: toFile :: FileLike b a => a -> Path b File
- Development.Shake.Plus.Config: readConfigFile :: MonadIO m => Path a File -> m (HashMap String String)
+ Development.Shake.Plus.Config: readConfigFile :: (MonadIO m, FileLike b a) => a -> m (HashMap String String)
- Development.Shake.Plus.Config: readConfigFileWithEnv :: MonadIO m => [(String, String)] -> Path a File -> m (HashMap String String)
+ Development.Shake.Plus.Config: readConfigFileWithEnv :: (MonadIO m, FileLike b a) => [(String, String)] -> a -> m (HashMap String String)
- Development.Shake.Plus.Config: usingConfigFile :: MonadRules m => Path a File -> m ()
+ Development.Shake.Plus.Config: usingConfigFile :: (MonadRules m, FileLike b a) => a -> m ()
- Development.Shake.Plus.Directory: doesDirectoryExist :: MonadAction m => Path b Dir -> m Bool
+ Development.Shake.Plus.Directory: doesDirectoryExist :: (MonadAction m, DirLike b a) => a -> m Bool
- Development.Shake.Plus.Directory: doesFileExist :: MonadAction m => Path b File -> m Bool
+ Development.Shake.Plus.Directory: doesFileExist :: (MonadAction m, FileLike b a) => a -> m Bool
- Development.Shake.Plus.Directory: getDirectoryDirs :: MonadAction m => Path b Dir -> m [Path Rel Dir]
+ Development.Shake.Plus.Directory: getDirectoryDirs :: (MonadAction m, DirLike b a) => a -> m [Path Rel Dir]
- Development.Shake.Plus.Directory: getDirectoryFiles :: MonadAction m => Path b Dir -> [FilePattern] -> m [Path Rel File]
+ Development.Shake.Plus.Directory: getDirectoryFiles :: (MonadAction m, DirLike b a) => a -> [FilePattern] -> m [Path Rel File]
- Development.Shake.Plus.Directory: getDirectoryFilesIO :: MonadIO m => Path b Dir -> [FilePattern] -> m [Path Rel File]
+ Development.Shake.Plus.Directory: getDirectoryFilesIO :: (MonadIO m, DirLike b a) => a -> [FilePattern] -> m [Path Rel File]
- Development.Shake.Plus.File: copyFile' :: (MonadAction m, Partial) => Path Rel File -> Path Rel File -> m ()
+ Development.Shake.Plus.File: copyFile' :: (MonadAction m, FileLike b a, Partial) => a -> a -> m ()
- Development.Shake.Plus.File: copyFileChanged :: (MonadAction m, Partial) => Path Rel File -> Path Rel File -> m ()
+ Development.Shake.Plus.File: copyFileChanged :: (MonadAction m, FileLike b a, FileLike b' a', Partial) => a -> a' -> m ()
- Development.Shake.Plus.File: readFile' :: (MonadAction m, Partial) => Path Rel File -> m Text
+ Development.Shake.Plus.File: readFile' :: (MonadAction m, FileLike b a, Partial) => a -> m Text
- Development.Shake.Plus.File: readFileIn' :: MonadAction m => Path Rel Dir -> Path Rel File -> m Text
+ Development.Shake.Plus.File: readFileIn' :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> m Text
- Development.Shake.Plus.File: readFileLines :: (MonadAction m, Partial) => Path Rel File -> m [Text]
+ Development.Shake.Plus.File: readFileLines :: (MonadAction m, FileLike b a, Partial) => a -> m [Text]
- Development.Shake.Plus.File: removeFiles :: MonadAction m => Path b File -> [FilePattern] -> m ()
+ Development.Shake.Plus.File: removeFiles :: (MonadAction m, DirLike b d) => d -> [FilePattern] -> m ()
- Development.Shake.Plus.File: removeFilesAfter :: MonadAction m => Path Rel Dir -> [FilePattern] -> m ()
+ Development.Shake.Plus.File: removeFilesAfter :: (MonadAction m, DirLike b d) => d -> [FilePattern] -> m ()
- Development.Shake.Plus.File: writeFile' :: (MonadAction m, Partial) => Path Rel File -> Text -> m ()
+ Development.Shake.Plus.File: writeFile' :: (MonadAction m, FileLike b a, Partial) => a -> Text -> m ()
- Development.Shake.Plus.File: writeFileChanged :: (MonadAction m, Partial) => Path b File -> Text -> m ()
+ Development.Shake.Plus.File: writeFileChanged :: (MonadAction m, FileLike b a, Partial) => a -> Text -> m ()
- Development.Shake.Plus.File: writeFileChangedIn :: MonadAction m => Path Rel Dir -> Path Rel File -> Text -> m ()
+ Development.Shake.Plus.File: writeFileChangedIn :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> Text -> m ()
- Development.Shake.Plus.File: writeFileIn' :: MonadAction m => Path Rel Dir -> Path Rel File -> Text -> m ()
+ Development.Shake.Plus.File: writeFileIn' :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> Text -> m ()
- Development.Shake.Plus.File: writeFileLines :: (MonadAction m, Partial) => Path Rel File -> [Text] -> m ()
+ Development.Shake.Plus.File: writeFileLines :: (MonadAction m, FileLike b a, Partial) => a -> [Text] -> m ()
- Development.Shake.Plus.FileRules: needIn :: (Partial, MonadAction m, Traversable t) => Path b Dir -> t (Path Rel File) -> m ()
+ Development.Shake.Plus.FileRules: needIn :: (Partial, MonadAction m, Traversable t, DirLike Rel d, FileLike Rel a) => d -> t a -> m ()
- Development.Shake.Plus.FileRules: needP :: (Partial, MonadAction m, Traversable t) => t (Path b File) -> m ()
+ Development.Shake.Plus.FileRules: needP :: (Partial, MonadAction m, Traversable t, FileLike b a) => t a -> m ()
- Development.Shake.Plus.FileRules: needWithin :: (Partial, MonadAction m, Traversable t) => Within b (t (Path Rel File)) -> m ()
+ Development.Shake.Plus.FileRules: needWithin :: (Partial, MonadAction m, Traversable t, FileLike Rel a) => Within Rel (t a) -> m ()
- Development.Shake.Plus.FileRules: wantIn :: (Partial, MonadRules m, Traversable t) => Path b Dir -> t (Path Rel File) -> m ()
+ Development.Shake.Plus.FileRules: wantIn :: (Partial, MonadRules m, Traversable t, DirLike Rel d, FileLike Rel a) => d -> t a -> m ()
- Development.Shake.Plus.FileRules: wantP :: (Partial, MonadRules m, Traversable t) => t (Path b File) -> m ()
+ Development.Shake.Plus.FileRules: wantP :: (Partial, MonadRules m, Traversable t, FileLike b a) => t a -> m ()
- Development.Shake.Plus.FileRules: wantWithin :: (Partial, MonadRules m, Traversable t) => Within b (t (Path Rel File)) -> m ()
+ Development.Shake.Plus.FileRules: wantWithin :: (Partial, MonadRules m, Traversable t, FileLike Rel a) => Within Rel (t a) -> m ()

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for shake-plus +## v0.2.0.0++* Add dependency on [path-like](https://hackage.haskell.org/package/path-like).+* Update interface to use `FileLike` and `DirLike` and drop `Path` and `Within` specific variants.+ ## v0.1.10.0  * Add unlifted versions of `parallel`, `forP` and `par`.
README.md view
@@ -64,7 +64,7 @@ produces `Within` values.  ```{.haskell}-getDirectoryFilesWithin' :: MonadAction m => Path b Dir -> [FilePattern] -> m [Within b (Path Rel File)]+getDirectoryFilesWithin' :: MonadAction m => Within Rel [FilePattern] -> m [Within b (Path Rel File)] ```  You can convert to and from this within-style using `within` and `fromWithin`.@@ -94,6 +94,16 @@ in the `Within` library for when the map between parent directories may throw. The `Within` library also contains more functions and instances for more precise changes between output and source directories.++## PathLike, FileLike and DirLike++The [path-like](https://hackage.haskell.org/package/path-like) library provides+type classes for things which are at least as strict as the `Path` type itself.+All `Paths` are `PathLike`, a `Path b File` is `FileLike b` and a `Path b Dir`+is `DirLike b`. A `Within b (Path Rel File)` is `FileLike b` and a `Within b+(Path Rel Dir) is `DirLike b`. The `readFile` and `writeFile` variants in+`shake-plus` can take any `FileLike`, and `copyFile` allows you to copy between+any two `FileLike`.  ## runShakePlus 
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
shake-plus.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 76e2dac824eafd666ea33e941e113adb9b74dd80e7e74a1e609278f5f2302ede+-- hash: 7f45c3348dd4258d68ebc0bc4ff243f60794401b1455d605c1f3b2d137ac7dd0  name:           shake-plus-version:        0.1.10.0+version:        0.2.0.0 synopsis:       Re-export of Shake using well-typed paths and ReaderT. description:    Re-export of Shake using well-typed paths and ReaderT. You can thread logging through your Shake Actions, and better keep track of source and output folders using the Within type. category:       development, shake@@ -49,7 +49,8 @@     , comonad     , extra     , path+    , path-like >=0.2.0.0     , rio     , shake-    , within+    , within >=0.2.0.0   default-language: Haskell2010
src/Development/Shake/Plus.hs view
@@ -1,3 +1,13 @@+{- |+   Module     : Development.Shake.Plus+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Module exports for Development.Shake.Plus. Re-exports everything in this package+as well as "Path", "Path.Like" and "Within".+-} module Development.Shake.Plus (   module Development.Shake.Classes , module Development.Shake.Plus.Cache@@ -10,6 +20,7 @@ , module Development.Shake.Plus.Oracle , module Development.Shake.Plus.Temp , module Path+, module Path.Like , module Within ) where @@ -24,4 +35,5 @@ import Development.Shake.Plus.Oracle import Development.Shake.Plus.Temp import Path+import Path.Like import Within
src/Development/Shake/Plus/Cache.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Cache+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Cache utilities in "Development.Shake" lifted to `MonadAction`.+-} module Development.Shake.Plus.Cache (   newCache , newCacheIO
src/Development/Shake/Plus/Command.hs view
@@ -1,4 +1,12 @@-{-# LANGUAGE TypeOperators #-}+{- |+   Module     : Development.Shake.Plus.Command+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Utilities in "Development.Shake.Command" lifted to `MonadAction`.+-} module Development.Shake.Plus.Command (   command , command_
src/Development/Shake/Plus/Config.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Config+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Utilities in "Development.Shake.Config" lifted to `MonadAction` and `FileLike`/`DirLike`.+-} module Development.Shake.Plus.Config (   readConfigFile , readConfigFileWithEnv@@ -11,19 +20,20 @@ import qualified Development.Shake.Config import           Development.Shake.Plus.Core import           Path+import           Path.Like import           RIO  -- | Lifted `Development.Shake.Config.readConfigFile` with well-typed path.-readConfigFile :: MonadIO m => Path a File -> m (HashMap String String)-readConfigFile = liftIO . Development.Shake.Config.readConfigFile . toFilePath+readConfigFile :: (MonadIO m, FileLike b a) => a -> m (HashMap String String)+readConfigFile = liftIO . Development.Shake.Config.readConfigFile . toFilePath . toFile  -- | Lifted `Development.Shake.Config.readConfigFileWithEnv` with well-typed path.-readConfigFileWithEnv :: MonadIO m => [(String, String)] -> Path a File -> m (HashMap String String)-readConfigFileWithEnv vars file = liftIO $ Development.Shake.Config.readConfigFileWithEnv vars (toFilePath file)+readConfigFileWithEnv :: (MonadIO m, FileLike b a) => [(String, String)] -> a -> m (HashMap String String)+readConfigFileWithEnv vars file = liftIO $ Development.Shake.Config.readConfigFileWithEnv vars (toFilePath . toFile $ file)  -- | Lifted `Development.Shake.Config.usingConfigFile` with well-typed path.-usingConfigFile :: MonadRules m => Path a File -> m ()-usingConfigFile = liftRules . Development.Shake.Config.usingConfigFile . toFilePath+usingConfigFile :: (MonadRules m, FileLike b a) => a -> m ()+usingConfigFile = liftRules . Development.Shake.Config.usingConfigFile . toFilePath . toFile  -- | Lifted `Development.Shake.Config.usingConfig`. usingConfig :: MonadRules m => HashMap String String -> m ()
src/Development/Shake/Plus/Core.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Core+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Core definitions of shake-plus.+-} module Development.Shake.Plus.Core (   MonadAction(..) , MonadRules(..)
src/Development/Shake/Plus/Database.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Database+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Utilities in "Development.Shake.Database" lifted to `MonadIO` and `MonadUnliftIO`.+-} module Development.Shake.Plus.Database (   Development.Shake.Database.ShakeDatabase , shakeOpenDatabase
src/Development/Shake/Plus/Directory.hs view
@@ -1,3 +1,13 @@+{- |+   Module     : Development.Shake.Plus.Directory+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Directory utilities in "Development.Shake" lifted to `MonadAction` and+`FileLike`/`DirLike`.+-} module Development.Shake.Plus.Directory (   doesFileExist , doesDirectoryExist@@ -14,20 +24,21 @@ import qualified Development.Shake import           Development.Shake.Plus.Core import           Path+import           Path.Like import           RIO import           Within  -- | Lifted version of `Development.Shake.doesFileExist` using well-typed `Path`s.-doesFileExist :: MonadAction m => Path b File -> m Bool-doesFileExist = liftAction . Development.Shake.doesFileExist . toFilePath+doesFileExist :: (MonadAction m, FileLike b a) => a -> m Bool+doesFileExist = liftAction . Development.Shake.doesFileExist . toFilePath . toFile  -- | Lifted version of `Development.Shake.doesDirectoryExist` using well-typed `Path`s.-doesDirectoryExist :: MonadAction m => Path b Dir -> m Bool-doesDirectoryExist = liftAction . Development.Shake.doesDirectoryExist . toFilePath+doesDirectoryExist :: (MonadAction m, DirLike b a) => a -> m Bool+doesDirectoryExist = liftAction . Development.Shake.doesDirectoryExist . toFilePath . toDir  -- | Lifted version of `Development.Shake.getDirectoryFiles` using well-typed `Path`s.-getDirectoryFiles :: MonadAction m => Path b Dir -> [FilePattern] -> m [Path Rel File]-getDirectoryFiles x y = liftAction $ traverse (liftIO . parseRelFile) =<< Development.Shake.getDirectoryFiles (toFilePath x) y+getDirectoryFiles :: (MonadAction m, DirLike b a) => a -> [FilePattern] -> m [Path Rel File]+getDirectoryFiles x y = liftAction $ traverse (liftIO . parseRelFile) =<< Development.Shake.getDirectoryFiles (toFilePath . toDir $ x) y  -- | Like `getDirectoryFiles`, but accepts a `Within` value and returns a `Within` contaning a list of `Path`s getDirectoryFilesWithin :: MonadAction m => Within b [FilePattern] -> m (Within b [Path Rel File])@@ -42,12 +53,12 @@   return ((<$ x) <$> xs)  -- | Lifted version of `Development.Shake.getDirectoryDirs` using well-typed `Path`s.-getDirectoryDirs :: MonadAction m => Path b Dir -> m [Path Rel Dir]-getDirectoryDirs x = liftAction $ traverse (liftIO . parseRelDir) =<< Development.Shake.getDirectoryDirs (toFilePath x)+getDirectoryDirs :: (MonadAction m, DirLike b a) => a -> m [Path Rel Dir]+getDirectoryDirs x = liftAction $ traverse (liftIO . parseRelDir) =<< Development.Shake.getDirectoryDirs (toFilePath . toDir $ x)  -- | Lifted version of `Development.Shake.getDirectoryFilesIO` using well-typed `Path`s.-getDirectoryFilesIO :: MonadIO m => Path b Dir -> [FilePattern] -> m [Path Rel File]-getDirectoryFilesIO x y = liftIO $ traverse (liftIO . parseRelFile) =<< Development.Shake.getDirectoryFilesIO (toFilePath x) y+getDirectoryFilesIO :: (MonadIO m, DirLike b a) => a -> [FilePattern] -> m [Path Rel File]+getDirectoryFilesIO x y = liftIO $ traverse (liftIO . parseRelFile) =<< Development.Shake.getDirectoryFilesIO (toFilePath . toDir $ x) y  -- | Like `getDirectoryFilesIO`, but accepts a `Within` value and returns a `Within` contaning a list of `Path`s getDirectoryFilesWithinIO :: MonadIO m => Within b [FilePattern] -> m (Within b [Path Rel File])
src/Development/Shake/Plus/Env.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Env+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Environenment variable utilities in "Development.Shake" lifted to `MonadAction`.+-} module Development.Shake.Plus.Env (   getEnv , getEnvWithDefault
src/Development/Shake/Plus/File.hs view
@@ -1,21 +1,31 @@+{- |+   Module     : Development.Shake.Plus.File+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++File utilities in "Development.Shake" lifted to `MonadAction` and+`FileLike`/`DirLike`.+-} module Development.Shake.Plus.File (-  copyFile'+  copyFile+, copyFile' , copyFileChanged-, copyFileWithin'-, copyFileChangedWithin+, copyFileChanged' , readFile' , readFileLines , readFileIn'-, readFileWithin , writeFile' , writeFileLines , writeFileIn'-, writeFileWithin , writeFileChanged , writeFileChangedIn-, writeFileChangedWithin , removeFiles , removeFilesAfter+, FileLike(..)+, DirLike(..)+, (/>) ) where  import           Control.Comonad.Env         as E@@ -23,77 +33,65 @@ import qualified Development.Shake import           Development.Shake.Plus.Core import           Path+import           Path.Like import           RIO import qualified RIO.Text                    as T-import           Within --- | Lifted version of `Development.Shake.copyFile` with well-typed `Path`s.-copyFile' :: (MonadAction m, Partial) => Path Rel File -> Path Rel File -> m ()-copyFile' x y = liftAction $ Development.Shake.copyFile' (toFilePath x) (toFilePath y)+-- | Lifted version of `Development.Shake.copyFile` that copies between any two `FileLike`.+copyFile :: (MonadAction m, FileLike b a, FileLike b' a', Partial) => a -> a' -> m ()+copyFile x y = liftAction $ Development.Shake.copyFile' (toFilePath . toFile $ x) (toFilePath . toFile $ y) --- | Lifted version of `Development.Shake.copyFileChanged'` with well-typed `Path`s.-copyFileChanged :: (MonadAction m, Partial) => Path Rel File -> Path Rel File -> m ()-copyFileChanged x y = liftAction $ Development.Shake.copyFileChanged (toFilePath x) (toFilePath y)+-- | Like `copyFile` but for `FileLike`s that are of the same type, useful for type inference.+copyFile' :: (MonadAction m, FileLike b a, Partial) => a -> a -> m ()+copyFile' = copyFile --- | Like copyFile', but accepts `Within` values.-copyFileWithin' :: (MonadAction m, Partial) => Within Rel (Path Rel File) -> Within Rel (Path Rel File) -> m ()-copyFileWithin' x y = copyFile' (fromWithin x) (fromWithin y)+-- | Lifted version of `Development.Shake.copyFileChanged'` that copies between two `FileLike'.+copyFileChanged :: (MonadAction m, FileLike b a, FileLike b' a', Partial) => a -> a' -> m ()+copyFileChanged x y = liftAction $ Development.Shake.copyFileChanged (toFilePath . toFile $ x) (toFilePath . toFile $ y) --- | Like copyFileChanged, but accepts `Within` values.-copyFileChangedWithin :: (MonadAction m, Partial) => Within Rel (Path Rel File) -> Within Rel (Path Rel File) -> m ()-copyFileChangedWithin x y = copyFileChanged (fromWithin x) (fromWithin y)+-- | Like `copyFileChanged` but ensures the `FileLike`s are of the same type, useful for type inference.+copyFileChanged' :: (MonadAction m, FileLike b a, Partial) => a -> a -> m ()+copyFileChanged' = copyFileChanged --- | Lifted version of `Development.Shake.readFile'` with well-typed `Path`.-readFile' :: (MonadAction m, Partial) => Path Rel File -> m Text-readFile' = liftAction . fmap T.pack . Development.Shake.readFile' . toFilePath+-- | Lifted version of `Development.Shake.readFile'` that reads any `FileLike`.+readFile' :: (MonadAction m, FileLike b a, Partial) => a -> m Text+readFile' = liftAction . fmap T.pack . Development.Shake.readFile' . toFilePath . toFile --- | Lifted version of `Development.Shake.readFileLines` with well-typed `Path`.-readFileLines :: (MonadAction m, Partial) => Path Rel File -> m [Text]-readFileLines = liftAction . fmap (fmap T.pack) . Development.Shake.readFileLines . toFilePath+-- | Lifted version of `Development.Shake.readFileLines` that reads any `FileLike`.+readFileLines :: (MonadAction m, FileLike b a, Partial) => a -> m [Text]+readFileLines = liftAction . fmap (fmap T.pack) . Development.Shake.readFileLines . toFilePath . toFile  -- | Like `readFile'`, but with an argument for the parent directory. Used for symmetry with -- the way `Development.Shake.getDirectoryFiles` takes arguments.-readFileIn' :: MonadAction m => Path Rel Dir -> Path Rel File -> m Text-readFileIn' x y = readFile' $ x </> y---- | Like 'readFile'`, but accepts a `Within` value.-readFileWithin :: MonadAction m => Within Rel (Path Rel File) -> m Text-readFileWithin = readFile' . liftA2 (</>) E.ask extract+readFileIn' :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> m Text+readFileIn' x y = readFile' $ x /> y --- | Lifted version of `Development.Shake.writeFile` with well-typed `Path`.-writeFile' :: (MonadAction m, Partial) => Path Rel File -> Text -> m ()-writeFile' x y = liftAction $ Development.Shake.writeFile' (toFilePath x) (T.unpack y)+-- | Lifted version of `Development.Shake.writeFile` that writes to any `FileLike`.+writeFile' :: (MonadAction m, FileLike b a, Partial) => a -> Text -> m ()+writeFile' x y = liftAction $ Development.Shake.writeFile' (toFilePath . toFile $ x) (T.unpack y) --- | Lifted version of `Development.Shake.writeFileLines` with well-typed `Path`.-writeFileLines :: (MonadAction m, Partial) => Path Rel File -> [Text] -> m ()-writeFileLines x y = liftAction $ Development.Shake.writeFileLines (toFilePath x) (fmap T.unpack y)+-- | Lifted version of `Development.Shake.writeFileLines` that writes to any `FileLike`.+writeFileLines :: (MonadAction m, FileLike b a, Partial) => a -> [Text] -> m ()+writeFileLines x y = liftAction $ Development.Shake.writeFileLines (toFilePath . toFile $ x) (fmap T.unpack y)  -- | Like `writeFile'`, but with an argument for the parent directory. Used for symmetry with -- the way `Development.Shake.getDirectoryFiles` takes arguments.-writeFileIn' :: MonadAction m => Path Rel Dir -> Path Rel File -> Text -> m ()-writeFileIn' x y = writeFile' $ x </> y---- | Like 'writeFile'`, but accepts a `Within` value.-writeFileWithin :: MonadAction m => Within Rel (Path Rel File) -> Text -> m ()-writeFileWithin = writeFile' . liftA2 (</>) E.ask extract+writeFileIn' :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> Text -> m ()+writeFileIn' x y = writeFile' $ x /> y --- | Lifted version of `Development.Shake.writeFileChanged` with well-typed `Path`.-writeFileChanged :: (MonadAction m, Partial) => Path b File -> Text -> m ()-writeFileChanged x y = liftAction $ Development.Shake.writeFileChanged (toFilePath x) (T.unpack y)+-- | Lifted version of `Development.Shake.writeFileChanged` that writes to any `FileLike`.+writeFileChanged :: (MonadAction m, FileLike b a, Partial) => a -> Text -> m ()+writeFileChanged x y = liftAction $ Development.Shake.writeFileChanged (toFilePath . toFile $ x) (T.unpack y)  -- | Like `writeFileChanged'`, but with an argument for the parent directory. Used for symmetry with -- the way `Development.Shake.getDirectoryFiles` takes arguments.-writeFileChangedIn :: MonadAction m => Path Rel Dir -> Path Rel File -> Text -> m ()-writeFileChangedIn x y = writeFileChanged $ x </> y---- | Like `writeFileChanged'`, but accepts a `Within` value.-writeFileChangedWithin :: MonadAction m => Within Rel (Path Rel File) -> Text -> m ()-writeFileChangedWithin = writeFileChanged . liftA2 (</>) E.ask extract+writeFileChangedIn :: (MonadAction m, DirLike b d, FileLike Rel a, Partial) => d -> a -> Text -> m ()+writeFileChangedIn x y = writeFileChanged $ x /> y --- | Lifted version of `Development.Shake.removeFiles` with well-typed `Path`.-removeFiles :: MonadAction m => Path b File -> [FilePattern] -> m ()-removeFiles x y = liftAction . liftIO $ Development.Shake.removeFiles (toFilePath x) y+-- | Lifted version of `Development.Shake.removeFiles` that accepts any `DirLike`.+removeFiles :: (MonadAction m, DirLike b d) => d -> [FilePattern] -> m ()+removeFiles x y = liftAction . liftIO $ Development.Shake.removeFiles (toFilePath . toDir $ x) y --- | Lifted version of `Development.Shake.removeFilesAfter` with well-typed `Path`.-removeFilesAfter :: MonadAction m => Path Rel Dir -> [FilePattern] -> m ()-removeFilesAfter x y = liftAction $ Development.Shake.removeFilesAfter (toFilePath x) y+-- | Lifted version of `Development.Shake.removeFilesAfter` that accepts any `DirLike`..+removeFilesAfter :: (MonadAction m, DirLike b d) => d -> [FilePattern] -> m ()+removeFilesAfter x y = liftAction $ Development.Shake.removeFilesAfter (toFilePath . toDir $ x) y
src/Development/Shake/Plus/FileRules.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.FileRules+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Filerules in "Development.Shake" lifted to `MonadAction` and `FileLike`/`DirLike`.+-} module Development.Shake.Plus.FileRules (   need , want@@ -5,12 +14,8 @@ , wantP , needIn , wantIn-, needInFP-, wantInFP , needWithin , wantWithin-, needWithin'-, wantWithin' , (%>) , (|%>) , (%^>)@@ -24,6 +29,7 @@ import qualified Development.Shake.FilePath import           Development.Shake.Plus.Core import           Path+import           Path.Like import           RIO                         as R import           Within @@ -40,44 +46,28 @@ want = liftRules . Development.Shake.want . toList  -- | Lifted version of `Development.Shake.need` using well-typed `Path`s-needP :: (Partial, MonadAction m, Traversable t) => t (Path b File) -> m ()-needP = need . fmap toFilePath+needP :: (Partial, MonadAction m, Traversable t, FileLike b a) => t a -> m ()+needP = need . fmap (toFilePath . toFile)  -- | Lifted version of `Development.Shake.want` using well-typed `Path`s-wantP :: (Partial, MonadRules m, Traversable t) => t (Path b File) -> m ()-wantP = want . fmap toFilePath---- | Like `need`, but accepts `Path`s relative to the first argument.-needInFP :: (Partial, MonadAction m, Traversable t) => Path b Dir -> t FilePattern -> m ()-needInFP x = need . fmap (toFilePath x Development.Shake.FilePath.</>)---- | Like `want`, but accepts `Path`s relative to the first argument.-wantInFP :: (Partial, MonadRules m, Traversable t) => Path b Dir -> t FilePattern -> m ()-wantInFP x = want . fmap (toFilePath x Development.Shake.FilePath.</>)+wantP :: (Partial, MonadRules m, Traversable t, FileLike b a) => t a -> m ()+wantP = want . fmap (toFilePath . toFile)  -- | Like `needP`, but accepts `Path`s relative to the first argument.-needIn :: (Partial, MonadAction m, Traversable t) => Path b Dir -> t (Path Rel File) -> m ()-needIn x = needP . fmap (x </>)+needIn :: (Partial, MonadAction m, Traversable t, DirLike Rel d, FileLike Rel a) => d -> t a -> m ()+needIn x = needP . fmap (x />)  -- | Like `wantP`, but accepts `Path`s relative to the first argument.-wantIn :: (Partial, MonadRules m, Traversable t) => Path b Dir -> t (Path Rel File) -> m ()-wantIn x = wantP . fmap (x </>)+wantIn :: (Partial, MonadRules m, Traversable t, DirLike Rel d, FileLike Rel a) => d -> t a -> m ()+wantIn x = wantP . fmap (x />)  -- | Like `needIn`, but accepts a list of `Path`s inside a `Within` value.-needWithin :: (Partial, MonadAction m, Traversable t) => Within b (t (Path Rel File)) -> m ()+needWithin :: (Partial, MonadAction m, Traversable t, FileLike Rel a) => Within Rel (t a) -> m () needWithin x = needIn (E.ask x) (extract x)  -- | Like `wantIn`, but accepts a list of `Path`s insides a `Within` value.-wantWithin :: (Partial, MonadRules m, Traversable t) => Within b (t (Path Rel File)) -> m ()+wantWithin :: (Partial, MonadRules m, Traversable t, FileLike Rel a) => Within Rel (t a) -> m () wantWithin x = wantIn (E.ask x) (extract x)---- | Like `needWithin`, but accepts a list of `Within`s instead of a `Within` of a list.-needWithin' :: (Partial, MonadAction m, Traversable t) => t (Within b (Path Rel File)) -> m ()-needWithin' x = needP $ fromWithin <$> x---- | Like `wantWithin`, but accepts a list of `Within`s instead of a `Within` of a list.-wantWithin' :: (Partial, MonadRules m, Traversable t) => t (Within b (Path Rel File)) -> m ()-wantWithin' x = wantP $ fromWithin <$> x  -- | Lifted version of `Development.Shake.%>` using well-typed `Path`s (%>) :: (Partial, MonadReader r m, MonadRules m) => FilePattern -> (Path Rel File -> RAction r ()) -> m ()
src/Development/Shake/Plus/Loaders.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Loaders+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Experimental loaders for shake-plus. Load a collection of `FilePattern`s as a `HashMap`.+-} module Development.Shake.Plus.Loaders (   batchLoad , batchLoadWithin
src/Development/Shake/Plus/Oracle.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Oracle+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Oracle utilities in "Development.Shake" lifted to `MonadAction` and `MonadRules`.+-} module Development.Shake.Plus.Oracle (   addOracle , addOracleCache
src/Development/Shake/Plus/Temp.hs view
@@ -1,3 +1,12 @@+{- |+   Module     : Development.Shake.Plus.Temp+   Copyright  : Copyright (C) 2020 Daniel Firth+   Maintainer : Daniel Firth <dan.firth@homotopic.tech+   License    : MIT+   Stability  : experimental++Temp utilities in "Development.Shake" unlifted to `MonadUnliftAction`.+-} module Development.Shake.Plus.Temp (   withTempFile , withTempDir