summaryrefslogtreecommitdiff
path: root/lib/SlackBuilder/Trans.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SlackBuilder/Trans.hs')
-rw-r--r--lib/SlackBuilder/Trans.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/SlackBuilder/Trans.hs b/lib/SlackBuilder/Trans.hs
index 6186c41..4ee3668 100644
--- a/lib/SlackBuilder/Trans.hs
+++ b/lib/SlackBuilder/Trans.hs
@@ -6,14 +6,16 @@
module SlackBuilder.Trans
( SlackBuilderException(..)
, SlackBuilderT(..)
+ , relativeToRepository
) where
-import Control.Monad.Trans.Reader (ReaderT(..))
+import Control.Monad.Trans.Reader (ReaderT(..), asks)
import Data.Text (Text)
import SlackBuilder.Config
import Control.Monad.IO.Class (MonadIO(..))
import Control.Monad.Catch (MonadCatch(..), MonadThrow(..))
import Control.Exception (Exception(..))
+import System.FilePath ((</>))
newtype SlackBuilderException = UpdaterNotFound Text
deriving Show
@@ -24,6 +26,10 @@ newtype SlackBuilderT a = SlackBuilderT
{ runSlackBuilderT :: ReaderT Settings IO a
}
+relativeToRepository :: FilePath -> SlackBuilderT FilePath
+relativeToRepository filePath =
+ (</> filePath) <$> SlackBuilderT (asks repository)
+
instance Functor SlackBuilderT
where
fmap f (SlackBuilderT slackBuilderT) = SlackBuilderT $ f <$> slackBuilderT