Re: [Haskell-cafe] Eta Reduction

2014-04-01 Thread John Lato
d data type contexts being needed in the language for bang patterns. :( > > -Edward > > On Apr 1, 2014, at 5:26 PM, John Lato wrote: > >> Hi Edward, >> >> Yes, I'm aware of that. However, I thought Dan's proposal especially droll given that changing seq t

Re: [Haskell-cafe] Eta Reduction

2014-04-01 Thread Edward Kmett
ought Dan's proposal especially droll > given that changing seq to a class-based function would be sufficient to make > eta-reduction sound, given appropriate instances (or lack thereof). Meaning > we could leave the rest of the proposal unevaluated (lazily!). > > And if somebody

Re: [Haskell-cafe] Eta Reduction

2014-04-01 Thread John Lato
Hi Edward, Yes, I'm aware of that. However, I thought Dan's proposal especially droll given that changing seq to a class-based function would be sufficient to make eta-reduction sound, given appropriate instances (or lack thereof). Meaning we could leave the rest of the proposal u

Re: [Haskell-cafe] Eta Reduction

2014-04-01 Thread Edward Kmett
element in the list. This has been fixed in 7.8, but there >> are >> other examples. I believe lens, [1] for instance, has some stuff in it >> that >> works very hard to avoid this sort of cost; and it's not always as easy >> to avoid >> as the above ex

Re: Eta Reduction

2014-04-01 Thread Carter Schonwald
as been fixed in 7.8, but there >> are >> other examples. I believe lens, [1] for instance, has some stuff in it >> that >> works very hard to avoid this sort of cost; and it's not always as easy >> to avoid >> as the above example. Composing with a

Re: Eta Reduction

2014-04-01 Thread John Lato
pe wrapper, for instance, > causes an > eta expansion that can only be seen as such at the core level. > > The obvious solution is: do eta reduction. However, this is not > operationally > sound currently. The problem is that seq is capable of telling the > difference > between

Eta Reduction

2014-03-31 Thread Dan Doel
that can only be seen as such at the core level. The obvious solution is: do eta reduction. However, this is not operationally sound currently. The problem is that seq is capable of telling the difference between the following two expressions: undefined \x -> undefined x The former ca

RE: Casting + eta reduction

2010-07-16 Thread Simon Peyton-Jones
ly 2010 17: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'

Re: Casting + eta reduction

2010-07-13 Thread Louis Wasserman
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 on a generalized trie library, and due to http://hackage.haskell.org/trac/ghc/ticket/4185, I can&

Re: Casting + eta reduction

2010-07-13 Thread Louis Wasserman
09 July 2010 03:30 > *To:* glasgow-haskell-users@haskell.org > *Subject:* Casting + eta reduction > > > > Consider > > > > newtype Foo = Foo Int > > > > lift :: (Int -> a) -> Foo -> a > > lift f (Foo x) = f x > > > &

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

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

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