#4293: Utility function for quasi-quoters: reading files
---------------------------------+------------------------------------------
Reporter: jonasduregard | Owner:
Type: proposal | Status: new
Priority: normal | Component: Template Haskell
Version: 6.12.3 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4293>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs