Utility function for quasi-quoters: reading files
I just wrote a useful combinator for quasi-quoters, you may want to include it in the Quote module. It takes an existing quasi-quoter and produces a quasi-quoter that statically reads and parses the content of a file.
quotefile :: QuasiQuoter -> QuasiQuoter
quotefile (QuasiQuoter exp pat) = QuasiQuoter (ff exp) (ff pat) where
ff old s = runIO (readFile s) >>= old
This is useful when you need to quote data from a separately maintained or generated source file.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |