What would it take to get an "-XOverloadedQuotes" flag of the same
sort as the "-XOverloadedStrings" flag?  I.e. "[| ... |]" would have
type "Quasi m => m Exp" instead of "Q Exp" and any splices in that
quotation expect the contents of that splice to have type "m Exp".
(Obviously, top level splices would still have type "Q Exp" otherwise
the compiler wouldn't know how to evaluate the monad.)

I ran into this problem when writing a Template Haskell program in
which part of it operates in a "StateT S Q a" monad instead of the
usual "Q a" monad.  (The "S" type stores the state of a memoization
table of code fragments already generated.  Without it, the code would
loop infinitely when processing certain recursive structures.)

It is fairly easy to declare an instance of "Quasi" for "StateT S Q",
so in order to keep the code clean, I'd like to use quotations with
splices in them (i.e. [| ... $( ... ) ... |] ) for expressing the
generated code.  However, quotations and splices are tied to the "Q"
monad which means that as it is now I have to manually write "LamE ...
VarP ... VarE ... etc." instead of using the much nicer quotation
syntax.

Michael D. Adams
[email protected]

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to