<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>I have the following kind of template haskell code:</p>
    <pre>module Foo where
foo :: String -> Name -> Q [Dec]
foo str name = return []

module Bar where
bar :: String
bar = "whatever"

module FooBar where
import Foo
import Bar
foo bar 'bar</pre>
    <p>It works great as in `foo` I can use both bar's Name and bar's
      value computed at compile time.</p>
    <p>But it's unsafe for my purpose because a user could call: `foo
      "fakeBarValue"  'bar`</p>
    <p>So the question is: is there a way to write `foo` so that it can
      only be used safely?</p>
    <p><br>
    </p>
    <p>If not, I guess it could be possible to add a new kind of quote
      to TH, something like:<br>
      <br>
      data Named a = Named Name a -- constructor not exported so that
      Named values can't be forged by users.<br>
      <br>
      [namedValue||bar||] :: Named String -- new quote</p>
    <p>What do you think?<br>
    </p>
    <p>Thanks,<br>
      Sylvain<br>
    </p>
  </body>
</html>