packages feed

shake-plus-extended 0.2.0.2 → 0.3.0.0

raw patch · 3 files changed

+33/−4 lines, 3 files

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for shake-plus-extended +## v0.3.0.0++* Add `SimpleSPlusEnv` with a `LogFunc` and a local `Path Rel Dir`.+* Rework `runSimpleShakePlus` to `runLoggedShakePlus` and add new `runSimpleShakePlus`.+ ## v0.2.0.0  * Re-export `Binary Path` orphan.
shake-plus-extended.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           shake-plus-extended-version:        0.2.0.2+version:        0.3.0.0 synopsis:       Experimental extensions to shake-plus description:    Experimental extensions to shake-plus - `within`-style file rules, HashMap and IxSet batch loaders. category:       development, shake
src/Development/Shake/Plus/Extended/Simple.hs view
@@ -8,17 +8,41 @@ Shortcuts to run shake-plus with a simple environment. -} module Development.Shake.Plus.Extended.Simple (- runSimpleShakePlus+  SimpleSPlusEnv(..)+, runLoggedShakePlus+, runSimpleShakePlus ) where  import           Control.Exception import           Development.Shake.Plus+import           Development.Shake.Plus.Extended.FileRules import           RIO +data SimpleSPlusEnv = SimpleSPlusEnv {+  logFunc  :: LogFunc+, localOut :: Path Rel Dir+}++instance HasLogFunc SimpleSPlusEnv where+  logFuncL = lens logFunc (\x y -> x { logFunc = y} )++instance HasLocalOut SimpleSPlusEnv where+  localOutL = lens localOut (\x y -> x { localOut = y})+ -- | Run a `ShakePlus` with just a `LogFunc` in the environment that logs to stderr.-runSimpleShakePlus :: MonadIO m => ShakePlus LogFunc a -> m ()-runSimpleShakePlus m = do+runLoggedShakePlus :: MonadIO m => ShakePlus LogFunc a -> m ()+runLoggedShakePlus m = do   lo <- logOptionsHandle stderr True   (lf, dlf) <- newLogFunc (setLogMinLevel LevelInfo lo)   liftIO $ shakeArgs shakeOptions $ void $ runShakePlus lf m+  dlf+++-- | Run a `ShakePlus` with just a `SimpleSPlusEnv`.+runSimpleShakePlus :: MonadIO m => Path Rel Dir -> ShakePlus SimpleSPlusEnv a -> m ()+runSimpleShakePlus outputFolder m = do+  lo <- logOptionsHandle stderr True+  (lf, dlf) <- newLogFunc (setLogMinLevel LevelInfo lo)+  let env = SimpleSPlusEnv lf outputFolder+  liftIO $ shakeArgs shakeOptions $ void $ runShakePlus env m   dlf