public
Created

addDependentFile

  • Download Gist
External.hs
Haskell
1 2 3 4 5 6 7 8 9 10 11
module External where
 
import Language.Haskell.TH.Syntax
import Language.Haskell.TH.Lib
 
loadStringFromFile :: Q Exp
loadStringFromFile = do
let externalDependency = "external.txt"
qAddDependentFile externalDependency
s <- qRunIO $ readFile externalDependency
stringE s
external.txt
1
Change Me!
main.hs
Haskell
1 2 3 4 5 6 7
-- main.hs
{-# LANGUAGE TemplateHaskell #-}
module Main where
import External (loadStringFromFile)
 
main :: IO ()
main = putStrLn $loadStringFromFile

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.