[Haskell-cafe] Designing DSL with explicit sharing [was: I love purity, but it's killing me]

Luke Palmer lrpalmer at gmail.com
Wed Feb 13 05:36:32 EST 2008


On Feb 13, 2008 9:33 AM,  <oleg at okmij.org> wrote:
> The approach is based on the final tagless representation. Here is our
> DSL:
>
> > class Exp repr where
> >    constant :: Int -> repr Int
> >    variable :: String -> repr Int
> >    add :: repr Int -> repr Int -> repr Int
> >    sub :: repr Int -> repr Int -> repr Int

This is very nice.  May I ask, though, what is the purpose of all the
Ints appearing as arguments to repr here?  Looking over this code, it
seems that it would work just as well if they were all omitted.

Thanks,
Luke


More information about the Haskell-Cafe mailing list