module OpenAPI.Generate.Internal.Embed where

import Language.Haskell.TH
import Language.Haskell.TH.Syntax

embedFile :: FilePath -> Q Exp
embedFile :: FilePath -> Q Exp
embedFile FilePath
fp = Lit -> Exp
LitE (Lit -> Exp) -> (FilePath -> Lit) -> FilePath -> Exp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> Lit
StringL (FilePath -> Exp) -> Q FilePath -> Q Exp
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (FilePath -> Q ()
forall (m :: * -> *). Quasi m => FilePath -> m ()
qAddDependentFile FilePath
fp Q () -> Q FilePath -> Q FilePath
forall a b. Q a -> Q b -> Q b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO FilePath -> Q FilePath
forall a. IO a -> Q a
runIO (FilePath -> IO FilePath
readFile FilePath
fp))