<div dir="ltr">Not that I really want to encourage such a &quot;stringly typed&quot; practice, but it wouldn&#39;t really be that much of a stretch.<br><br>* Use haskell-src-exts[0] and haskell-src-meta[1] to make a quasiquoter that can parse Haskell syntax<br>

* Use syb[2] or some other generics to find VarE and ConE expressions.  In order to use SYB with TH, you&#39;ll want th-orphans[3]<br>* Use &#39;reify&#39;[4] on the name of the variable or constructor, to see if it exists.  If it doesn&#39;t[5], replace it with (LitE (StringL (nameBase name)))<br>

<br>Shouldn&#39;t really be much code at all! :D<br><br>-Michael<br><br>[0] <a href="http://hackage.haskell.org/package/haskell-src-exts">http://hackage.haskell.org/package/haskell-src-exts</a><br>[1] <a href="http://hackage.haskell.org/package/haskell-src-meta">http://hackage.haskell.org/package/haskell-src-meta</a><br>

[2] <a href="http://hackage.haskell.org/package/syb">http://hackage.haskell.org/package/syb</a><br>[3] <a href="http://hackage.haskell.org/package/th-orphans">http://hackage.haskell.org/package/th-orphans</a><br>[4] <a href="http://hackage.haskell.org/packages/archive/template-haskell/latest/doc/html/Language-Haskell-TH.html#v:reify">http://hackage.haskell.org/packages/archive/template-haskell/latest/doc/html/Language-Haskell-TH.html#v:reify</a><br>

[5] <a href="http://byorgey.wordpress.com/2011/08/16/idempotent-template-haskell/">http://byorgey.wordpress.com/2011/08/16/idempotent-template-haskell/</a></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 31, 2013 at 11:41 PM, Mateusz Kowalczyk <span dir="ltr">&lt;<a href="mailto:fuuzetsu@fuuzetsu.co.uk" target="_blank">fuuzetsu@fuuzetsu.co.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 01/09/13 07:02, yi lu wrote:<br>
&gt; I want to know if it is possible that I use strings without &quot;&quot;.<br>
&gt;<br>
&gt; If I type<br>
</div>&gt; *Prelude&gt;foo bar*<br>
&gt; which actually I mean<br>
&gt; *Prelude&gt;foo &quot;bar&quot;*<br>
<div class="im">&gt; However I don&#39;t want to type &quot;&quot;s.<br>
&gt;<br>
</div>&gt; I have noticed if *bar* is predefined or it is a number, it can be used as<br>
<div class="im">&gt; arguments. But can other strings be used this way? Like in bash, we can use<br>
</div>&gt; *ping 127.0.0.1* where *127.0.0.1* is an argument.<br>
&gt;<br>
&gt; If not, can *foo* be defined as a function so that it recognize arguments<br>
&gt; like *bar* as *&quot;bar&quot;*?<br>
&gt;<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Yi Lu<br>
&gt;<br>
&gt;<br>
You can&#39;t do this non-trivially. I think your only bet would be Template<br>
Haskell using the second approach and even then, it&#39;s a huge, huge<br>
stretch. I highly recommend against such ideas though. Do you really<br>
want anything that&#39;s not bound to be treated as a String? (The answer is<br>
‘no’). I suggest that you get used to ‘&quot;’s.<br>
<br>
If you have deep hatred for ‘&quot;’, you could resort to spelling out the<br>
strings like [&#39;f&#39;, &#39;o&#39;, &#39;o&#39;] or even &#39;f&#39;:&#39;o&#39;:&#39;o&#39;:[].<br>
<br>
It&#39;s a bit like asking whether you can do addition everywhere by just<br>
typing the numbers to each other (no cheating and defining number<br>
literals as functions ;) ).<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Mateusz K.<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</font></span></blockquote></div><br></div>