{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
module Rib.Parser.Dhall
(
parse,
)
where
import Development.Shake
import Dhall (FromDhall, auto, input)
import Relude
import Rib.Shake (ribInputDir)
import System.Directory
import System.FilePath
parse ::
FromDhall a =>
[FilePath] ->
FilePath ->
Action a
parse deps f = do
inputDir <- ribInputDir
need deps
s <- toText <$> readFile' (inputDir </> f)
liftIO $ withCurrentDirectory inputDir $
input auto s