-- | Read YX project configuration cache file, which is just the same as
-- @yx.yaml@ or @yx.yml@ (see also 'yxConfigs'), but stored more efficiently.
--
-- /Throws: 'CacheDecodingException'/
readCachedYxConfig :: FilePath -> IO ProjectConfig
readCachedYxConfig cfg =
    (Aeson.eitherDecode' <$> Lazy.ByteString.readFile cfg) >>= \case
        Left e -> throwIO $ CacheDecodingException cfg e
            -- TODO: Maybe we could try to parse the YAML file in this case.
        Right r -> pure r

-- | Parse YX project configuration file @yx.yaml@ or @yx.yml@ (see also
-- 'yxConfigs').
--
-- /Throws: 'Data.Yaml.ParseException'/
readCachedYxConfig :: FilePath -> IO ProjectConfig
readCachedYxConfig cfg =
    (Aeson.eitherDecode' <$> Lazy.ByteString.readFile cfg) >>= \case
        Left e -> throwIO $ CacheDecodingException cfg e
            -- TODO: Maybe we could try to parse the YAML file in this case.
        Right r -> pure r

-- | Parse YX project configuration file @yx.yaml@ or @yx.yml@ (see also
-- 'yxConfigs').
--
-- /Throws: 'Data.Yaml.ParseException'/
readCachedYxConfig cfg =
    (Aeson.eitherDecode' <$> Lazy.ByteString.readFile cfg) >>= \case
        Left e -> throwIO $ CacheDecodingException cfg e
            -- TODO: Maybe we could try to parse the YAML file in this case.
        Right r -> pure r

-- | Parse YX project configuration file @yx.yaml@ or @yx.yml@ (see also
-- 'yxConfigs').
--
-- /Throws: 'Data.Yaml.ParseException'/