[Haskell] Re: [Haskell-cafe] ANN: cmonad 0.1.1

Don Stewart dons at galois.com
Mon Mar 30 14:13:32 EDT 2009

Duncan and I have thought about this too, exactly as you describe.

    (Just !x)
    (# tag#, x# #)

-- Don

> When I looked at it a year ago or so, it was a return of one
> constructor in a sum.
> Looking at core, you can see several places where a function is called
> and that function always returns the same constructor, so the case
> analysis of the return value is not needed; it should be returned as
> an unboxed tuple instead
> I'll see if I can get a simple example to illustrate the problem.
> I talked to Simon PJ about it and he thought an analysis and
> transformation for such a thing would be a good idea, but someone has
> to do the work, of course.
> Another unrelated problem, I think, is that ghc needs to promote
> in-memory variables to registers when possible.
> Perhaps the new code generator has such a transformation?
>   -- Lennart
> On Mon, Mar 30, 2009 at 3:28 AM, Don Stewart <dons at galois.com> wrote:
> > Nested constructed product returns? Or constructed sums?
> >
> > lennart:
> >> Well, yes and no.  GHC actually does a decent job when given very
> >> imperative code with references and mutable arrays.
> >> Now the type I use to wrap the references to get type safe l-values
> >> and r-values makes it tricker, and ghc lacks a crucial optimization
> >> for specialization of constructor returns.
> >> With that in place I think the code could be quite performant.
> >

More information about the Haskell-Cafe mailing list