{-# LANGUAGE NoImplicitPrelude #-} module Panda.Model.Helper where import Panda.Helper.Env import qualified Panda.Config.Global as G import Panda.Type.Reader import Panda.Type.Plugin (apply_plugin) get_body id = (G.flat_uri / id) .read_file >>= apply_plugin_for_resource id get_reader id = id.take_extension.guess_reader.fromMaybe G.default_reader apply_plugin_for_resource id | id.id_to_type.belongs_to [G.post_id, G.static_id] = apply_plugin | otherwise = return