runHaapHakyllT :: (HaapStack t m,MonadIO m) => PluginI Hakyll -> Haap (HakyllT :..: t) m a -> Haap t m a
runHaapHakyllT args m = do
    let go :: (MonadIO m,HaapStack t m) => forall b . (HakyllT :..: t) m b -> t m b
        go (ComposeT (HakyllT m)) = do
            (e,hp,(rules,noignores)) <- RWS.runRWST m (args) (hakyllP args)
            let datarules = do
                matchDataTemplates
                when (hakyllMatch args) $ matchDataCSSs >> matchDataJSs
                rules
            let ignore fp = {-trace ("ignore?" ++ fp ++" "++ show b1 ++ " " ++ show b2)-} (b1 || b2)
                    where
                    b1 = not $ any (\p -> p `isPrefixOf` fp || fp `isPrefixOf` p) noignores
                    b2 = ignoreFile (hakyllCfg args) fp
            let cfg = (hakyllCfg args) { ignoreFile = ignore }
            let build = withArgs ["build"] $ hakyllWithExitCode cfg datarules
            let clean = withArgs ["clean"] $ hakyllWithExitCode cfg datarules
            lift $ liftIO $ putStrLn $ "Running Hakyll without ignoring... " ++ prettyString noignores 
            lift $ liftIO $ hakyllIO hp $ if (hakyllClean args)
                then clean >> build
                else build
            --    else catch
            --        (build >>= \e -> case e of { ExitFailure _ -> clean >> build; otherwise -> return e })
            --        (\(err::SomeException) -> clean >> build)
            return e
    when (hakyllCopy args) $ copyDataFiles (hakyllCfg args)
    let datapaths = if hakyllMatch args then ["js","css"] else []
    e <- mapHaapMonad go $ hakyllFocus datapaths m
    return e
runHaapHakyllT :: (HaapStack t m,MonadIO m) => PluginI Hakyll -> Haap (HakyllT :..: t) m a -> Haap t m a
runHaapHakyllT args m = do
    let go :: (MonadIO m,HaapStack t m) => forall b . (HakyllT :..: t) m b -> t m b
        go (ComposeT (HakyllT m)) = do
            (e,hp,(rules,noignores)) <- RWS.runRWST m (args) (hakyllP args)
            let datarules = do
                matchDataTemplates
                when (hakyllMatch args) $ matchDataCSSs >> matchDataJSs
                rules
            let ignore fp = {-trace ("ignore?" ++ fp ++" "++ show b1 ++ " " ++ show b2)-} (b1 || b2)
                    where
                    b1 = not $ any (\p -> p `isPrefixOf` fp || fp `isPrefixOf` p) noignores
                    b2 = ignoreFile (hakyllCfg args) fp
            let cfg = (hakyllCfg args) { ignoreFile = ignore }
            let build = withArgs ["build"] $ hakyllWithExitCode cfg datarules
            let clean = withArgs ["clean"] $ hakyllWithExitCode cfg datarules
            lift $ liftIO $ putStrLn $ "Running Hakyll without ignoring... " ++ prettyString noignores 
            lift $ liftIO $ hakyllIO hp $ if (hakyllClean args)
                then clean >> build
                else build
            --    else catch
            --        (build >>= \e -> case e of { ExitFailure _ -> clean >> build; otherwise -> return e })
            --        (\(err::SomeException) -> clean >> build)
            return e
    when (hakyllCopy args) $ copyDataFiles (hakyllCfg args)
    let datapaths = if hakyllMatch args then ["js","css"] else []
    e <- mapHaapMonad go $ hakyllFocus datapaths m
    return e
runHaapHakyllT args m = do
    let go :: (MonadIO m,HaapStack t m) => forall b . (HakyllT :..: t) m b -> t m b
        go (ComposeT (HakyllT m)) = do
            (e,hp,(rules,noignores)) <- RWS.runRWST m (args) (hakyllP args)
            let datarules = do
                matchDataTemplates
                when (hakyllMatch args) $ matchDataCSSs >> matchDataJSs
                rules
            let ignore fp = {-trace ("ignore?" ++ fp ++" "++ show b1 ++ " " ++ show b2)-} (b1 || b2)
                    where
                    b1 = not $ any (\p -> p `isPrefixOf` fp || fp `isPrefixOf` p) noignores
                    b2 = ignoreFile (hakyllCfg args) fp
            let cfg = (hakyllCfg args) { ignoreFile = ignore }
            let build = withArgs ["build"] $ hakyllWithExitCode cfg datarules
            let clean = withArgs ["clean"] $ hakyllWithExitCode cfg datarules
            lift $ liftIO $ putStrLn $ "Running Hakyll without ignoring... " ++ prettyString noignores 
            lift $ liftIO $ hakyllIO hp $ if (hakyllClean args)
                then clean >> build
                else build
            --    else catch
            --        (build >>= \e -> case e of { ExitFailure _ -> clean >> build; otherwise -> return e })
            --        (\(err::SomeException) -> clean >> build)
            return e
    when (hakyllCopy args) $ copyDataFiles (hakyllCfg args)
    let datapaths = if hakyllMatch args then ["js","css"] else []
    e <- mapHaapMonad go $ hakyllFocus datapaths m
    return e