shake-plus

Re-export of Shake using well-typed paths and ReaderT.

Version on this page:0.3.4.0
LTS Haskell 22.41:0.3.4.0@rev:1
Stackage Nightly 2024-11-10:0.3.4.0@rev:1
Latest on Hackage:0.3.4.0@rev:1

See all snapshots shake-plus appears in

MIT licensed by Daniel Firth
Maintained by [email protected]
This version can be pinned in stack with:shake-plus-0.3.4.0@sha256:266684a410a5486baa25bc20c662143ad78d706165020dcac332817449bc4408,2430
Depends on 5 packages(full list with versions):

Shake+ - Super Powered Shake

Attempt at a batteries included Shake. We reexport replacements for the main utility functions of Shake with the following adjustments whereever possible.

  • Well-typed paths using the path library.
  • New type classes MonadAction, MonadUnliftAction and MonadRules with concrete ReaderT transformers:
    • RAction r a = RAction (ReaderT r Action a) and
    • ShakePlus r a = ShakePlus (ReaderT r Rules a)
  • Text instead of String wherever it is appropriate.

Paths

Using the path library is kind of a no brainer. I lose a lot of time to problems that could be avoided by using this library, so it’s everywhere. The names for these functions shadow the existing names, so you may want to import qualified Development.Shake while this library progresses if you have other FilePath based Shake rules that you want to mix into your build.

The standard Development.Shake.FilePath functions for directory manipulation are not re-exported in full, and you should use the functions in the path library (such as replaceExtension) and other path-based libraries. This will probably change.

FilePatterns are kept as-is, as Path is strongly normalizing it makes sense to keep these as Strings.

RAction

The ReaderT r Action a transformer (called RAction) is similar to the RIO type and should be used similarly. In fact, you can reuse the logging functions from RIO within any RAction block, which is one of the main motivators for having an Action which is also a MonadReader. If you need to reuse an existing shake Action in an RAction, use liftAction.

runShakePlus

The main entry point to this library is the runShakePlus function, which collapses a ReaderT r Rules () to a Rules () and passes the environment to each underlying RAction. The rs in ShakePlus and the underlying RActions have to match. A typical setup might look like this.

let r = --setup env here
shake shakeOptions $ do

    -- include some regular shake rules.

    runShakePlus r $ do

      -- some shake-plus rules.

Changes

Changelog for shake-plus

v0.3.4.0

  • Fix for GHC 9’s simplified subsumption change.

v0.3.3.0

  • Re-export RuleResult and ShakeValue.

v0.3.2.0

  • Re-export Development.Shake.Forward.

v0.3.1.0

  • Remove unnecessary comonad dependency.

v0.3.0.0

  • Drop dependency on path-like.
  • Drop dependency on within.
  • Drop Development.Shake.Plus.Loaders module.
  • Restore monomorphic Path variants of everything.
  • Move within style combinators to shake-plus-extended.

v0.2.0.0

  • Add dependency on 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.

v0.1.9.0

  • Add lower bound to aeson.
  • Remove hashable dependency.

v0.1.8.0

  • Reexport Development.Shake.Classes and Development.Shake.RuleResult.

v0.1.7.0

  • Add runSimpleShakePlus for quickrunning with args and a log function.

v0.1.6.0

  • Re-export Path and Within.

v0.1.5.0

  • Add getDirectoryFilesWithinIO and getDirectoryFilesWithinIO'

v0.1.4.0

  • Re-export Development.Shake.shakeArgs.

v0.1.3.0

  • Re-export Development.Shake.Command with lifted command and command_.

v0.1.2.0

  • Add copyFileWithin' and copyFileChangedWithin.

v0.1.1.0

  • Make Within style functions more consistent in that they actually take Within values across the board.
  • Make batchLoad functions more consistent and usable.
  • need and want variants now take any Traversable.

v0.1.0.0

  • Update to within-0.1.1.0 which changes the data type to an Env comonad.
  • Drop the loadSortFilterApply loader functions in favour of a simpler batchLoad set of functions which accepts a loading function which can be cached.
  • Add enough documentation to get started.

v0.0.2.1

  • Add functions based on Within to better keep track of source and target directories.
  • Reexport more shake functions to remove need to import vanilla shake qualified.
  • Add convenience functions loadSortFilterApply and loadSortFilterApplyW for batch loading via MonadAction.
  • Add more of the API surface with Path and Within including variants of need, want readFile, writeFile.

v0.0.1.0

  • Initial sketch of shake-plus with reexported functions. Mostly oracles, filepaths and directory functions using Path, and MonadAction, MonadUnliftAction and MonadRules with ReaderT transformers in a similar style to RIO