[Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

Edward Kmett ekmett at gmail.com
Sat Sep 26 11:41:08 EDT 2009

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
-> r Int, char :: Char -> 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.

On Fri, Sep 25, 2009 at 12:05 AM, Brad Larsen <brad.larsen at gmail.com> wrote:

> Bruno,
> On Thu, Sep 24, 2009 at 1:20 AM, Bruno Oliveira <bruno at ropas.snu.ac.kr>
> wrote:
> > Hello Brad,
> >
> > I believe that the problem you encountered is not quite the expression
> > problem (which is about adding new constructors and functions modularly),
> > but rather about refining *existing* constructs with more specific types.
> > One could argue that they are related though but, for your own sake, you
> may
> > want to use a term that more directly points to the problem in question.
> [...]
> Indeed, for finding existing approaches to this problem, it is prudent
> to know what others refer to it as.  If you squint a little, this
> looks like an instance of the expression problem: type classes are
> (families of) constructors, and instances of those type classes (i.e.,
> interpretations) are functions on those constructors.
> Sincerely,
> Brad
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090926/61021d72/attachment.html

More information about the Haskell-Cafe mailing list