Created
May 30, 2016 12:34
-
-
Save markhibberd/669018f67777b96624648c799400abe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
module Boris.Http.TH ( | |
embed | |
) where | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import Language.Haskell.TH | |
import Language.Haskell.TH.Syntax (qAddDependentFile) | |
import P | |
import System.IO (FilePath) | |
embed :: FilePath -> Q Exp | |
embed f = do | |
qAddDependentFile f | |
t <- runIO (T.readFile f) | |
appE (varE 'T.pack) . litE . StringL . T.unpack $ t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment