RE: Casting + eta reduction

2010-07-16 Thread Simon Peyton-Jones
:46 To: Simon Peyton-Jones Cc: glasgow-haskell-users@haskell.org Subject: Re: Casting + eta reduction Or a different way: I want -fdo-lambda-eta-expansion (which, if I understand correctly, actually triggers eta *reduction*) to eliminate argument casts, as well. My motivation: I'm working

RE: Casting + eta reduction

2010-07-13 Thread Simon Peyton-Jones
Subject: Casting + eta reduction Consider newtype Foo = Foo Int lift :: (Int - a) - Foo - a lift f (Foo x) = f x Now, I'd expect this to compile with -O2 down to something like lift f = f `cast` (Foo - a) but it doesn't. It seems that GeneralizedNewtypeDeriving assumes that these two things

Re: Casting + eta reduction

2010-07-13 Thread Louis Wasserman
+ eta reduction Consider newtype Foo = Foo Int lift :: (Int - a) - Foo - a lift f (Foo x) = f x Now, I'd expect this to compile with -O2 down to something like lift f = f `cast` (Foo - a) but it doesn't. It seems that GeneralizedNewtypeDeriving assumes that these two things

Re: Casting + eta reduction

2010-07-13 Thread Louis Wasserman
with that? Simon *From:* glasgow-haskell-users-boun...@haskell.org [mailto: glasgow-haskell-users-boun...@haskell.org] *On Behalf Of *Louis Wasserman *Sent:* 09 July 2010 03:30 *To:* glasgow-haskell-users@haskell.org *Subject:* Casting + eta reduction Consider newtype Foo = Foo Int lift

Re: Casting + eta reduction

2010-07-12 Thread Brent Yorgey
On Thu, Jul 08, 2010 at 09:30:23PM -0500, Louis Wasserman wrote: Consider newtype Foo = Foo Int lift :: (Int - a) - Foo - a lift f (Foo x) = f x Now, I'd expect this to compile with -O2 down to something like lift f = f `cast` (Foo - a) but it doesn't. It seems that

Casting + eta reduction

2010-07-08 Thread Louis Wasserman
Consider newtype Foo = Foo Int lift :: (Int - a) - Foo - a lift f (Foo x) = f x Now, I'd expect this to compile with -O2 down to something like lift f = f `cast` (Foo - a) but it doesn't. It seems that GeneralizedNewtypeDeriving assumes that these two things *are* equivalent, and it just