Added a comment about the includeStr "macro"
This commit is contained in:
parent
fd64a7e669
commit
defe409d78
1 changed files with 8 additions and 3 deletions
|
|
@ -4,7 +4,12 @@ import Control.Monad
|
|||
import Language.Haskell.TH
|
||||
import System.IO.Unsafe(unsafePerformIO)
|
||||
|
||||
-- While this is hacky (specifically the use of unsafePerformIO)
|
||||
-- in this case I think it is fine, as if an invalid string
|
||||
-- is passed to the function it will fail to compile,
|
||||
-- which is the intended behavior. This allows us to
|
||||
-- import strings (such as our "standard LLVM library")
|
||||
-- during compile time, removing the need to ship the source for
|
||||
-- that with the compiler.
|
||||
includeStr :: String -> Q Exp
|
||||
includeStr file = do
|
||||
let res = unsafePerformIO $ readFile file
|
||||
[|res|]
|
||||
includeStr file = [|unsafePerformIO $ readFile file|]
|
||||
Loading…
Add table
Add a link
Reference in a new issue