Utility function for quasi-quoters: reading files
|Reported by:||jonasduregard||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
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.