<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 30, 2015 at 7:05 PM, adam vogt <span dir="ltr"><<a href="mailto:vogt.adam@gmail.com" target="_blank">vogt.adam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Greg,<br>
<br>
Perhaps a less-invasive way to implement the -XSafe part of your<br>
proposal would be to provide a module like:<br>
<br>
module Language.Haskell.TH.Safe (<br>
  module <a href="http://Language.Haskell.TH" target="_blank">Language.Haskell.TH</a>,<br>
  reifyWithoutNameG,<br>
 )  where<br>
import <a href="http://Language.Haskell.TH" target="_blank">Language.Haskell.TH</a> hiding (runIO, reify*)<br>
<br>
where reifyWithoutNameG is the same as reify, except definitions that<br>
are out of scope are either missing or modified such that they use<br>
NameQ instead of NameG for out-of-scope names.<br></blockquote><div><br></div><div>Thanks, I added this concept to the wiki.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
That way there is no new syntax needed, and safe TH can be called by<br>
unsafe TH without any conversions.<br>
<br>
I think defining another monad like Q that can do less is too<br>
inconvenient because you have to disambiguate between Safe.listE and<br>
Unsafe.listE, or make those functions more polymorphic (which makes<br>
type errors worse). Another option would be if there were<br></blockquote><div><br></div><div>Oh, you are getting into more concrete details now than I have even thought about!</div><div>For the restricted monad route, we might look into a more capable method of using capabilities that would end up looking like this:</div><div><br></div><div>reify :: Name -> Restrict (TH :+: Reify) Info</div><div>runIO :: IO a -> Restrict (TH :+: RunIO) a</div><div><br></div><div>There are still a lot of details to work out, thanks for getting things started.</div></div></div></div>