I would just like to add that Oleg and Chung-chieh made sure in their finally tagless paper to use monomorphic lifting of literals explicitly to avoid this sort of ambiguity. Using Num or another typeclass is fine as long as all you want to do is evaluate your EDSL. But what about partial evaluation? CPS transformation? Compilation? You might be able to muddle through the first two, but compilation will derail your solution. Ultimately you will not be able to work over arbitrary Num instances if you want to do more than interpret. That was the main point of the monomorphic int :: Int -&gt; r Int, char :: Char -&gt; r Char methods they were using. If all I know about something is that there is a valid Num instance for it I have no way to emit machine code for it.<div>
<br></div><div>-Edward<br><br><div class="gmail_quote">On Fri, Sep 25, 2009 at 12:05 AM, Brad Larsen <span dir="ltr">&lt;<a href="mailto:brad.larsen@gmail.com">brad.larsen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Bruno,<br>
<br>
On Thu, Sep 24, 2009 at 1:20 AM, Bruno Oliveira &lt;<a href="mailto:bruno@ropas.snu.ac.kr">bruno@ropas.snu.ac.kr</a>&gt; wrote:<br>
&gt; Hello Brad,<br>
&gt;<br>
&gt; I believe that the problem you encountered is not quite the expression<br>
&gt; problem (which is about adding new constructors and functions modularly),<br>
&gt; but rather about refining *existing* constructs with more specific types.<br>
&gt; One could argue that they are related though but, for your own sake, you may<br>
&gt; want to use a term that more directly points to the problem in question.<br>
[...]<br>
<br>
Indeed, for finding existing approaches to this problem, it is prudent<br>
to know what others refer to it as.  If you squint a little, this<br>
looks like an instance of the expression problem: type classes are<br>
(families of) constructors, and instances of those type classes (i.e.,<br>
interpretations) are functions on those constructors.<br>
<br>
<br>
Sincerely,<br>
<font color="#888888">Brad<br>
</font><div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br></div>