-- | Functions in this module check for the presence of various build tools.
module Development.Shake.Check ( checkExecutable
                               -- * Helper functions for specific programs
                               , pandoc
                               , autoconf
                               , patsFilter
                               ) where

import           Control.Monad.IO.Class
import           Data.Maybe             (isJust)
import           System.Directory       (findExecutable)

checkExecutable :: (MonadIO m) => String -> m Bool
checkExecutable = fmap isJust . liftIO . findExecutable

pandoc :: (MonadIO m) => m Bool
pandoc = checkExecutable "pandoc"

autoconf :: (MonadIO m) => m Bool
autoconf = checkExecutable "autoconf"

patsFilter :: (MonadIO m) => m Bool
patsFilter = checkExecutable "pats-filter"