RE: Abstracting over things that can be unpacked

2012-03-06 Thread Simon Peyton-Jones
First idea: instead of rejecting unpack pragmas on polymorphic fields, have them require a class constraint on the field types. Example: data UnboxPair a b = (Unbox a, Unbox b) => UP {-# UNPACK #-} !a {-# UNPACK #-} !b The Unbox type class would be similar in spirit to the class with the s

Re: Abstracting over things that can be unpacked

2012-03-05 Thread Aleksey Khudyakov
> As I mentioned further up in the email, I think this needs to be done at > compile time. However, I'm not sure type classes are the right mechanism, as > they don't guarantee that the polymorphism is resolved at compile time. > Perhaps type families, in some form, is the right solution. > There i

Re: Abstracting over things that can be unpacked

2012-03-04 Thread Johan Tibell
On Sat, Mar 3, 2012 at 8:06 AM, Twan van Laarhoven wrote: > I expect that this will not be easy to implement, because it requires > interaction with things like the garbage collector. For example, UnboxPair > will need a different info table for different a and b. > > It might be possible to esse

Re: Abstracting over things that can be unpacked

2012-03-03 Thread Twan van Laarhoven
On 03/03/12 01:40, Johan Tibell wrote: Hi all, These ideas are still in very early stages. I present them here in hope of starting a discussion. (We discussed this quite a bit at last year's ICFP, I hope this slightly different take on the problem might lead to new ideas.) I think the next big

Re: Abstracting over things that can be unpacked

2012-03-03 Thread Ryan Newton
+1 ! On Fri, Mar 2, 2012 at 7:40 PM, Johan Tibell wrote: > Hi all, > > These ideas are still in very early stages. I present them here in hope of > starting a discussion. (We discussed this quite a bit at last year's ICFP, > I hope this slightly different take on the problem might lead to new i

Abstracting over things that can be unpacked

2012-03-02 Thread Johan Tibell
Hi all, These ideas are still in very early stages. I present them here in hope of starting a discussion. (We discussed this quite a bit at last year's ICFP, I hope this slightly different take on the problem might lead to new ideas.) I think the next big step in Haskell performance is going to c