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'
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't use
Gener
Mmmm, let's give a slightly different example:
foo :: Foo -> Int
foo (Foo a) = a + 1
bar :: Int -> Int
bar = foo . Foo
and I'd expect bar to be replaced with (foo `cast` (Int -> Int)) and
inlined, eliminating an allocation. In general, we'd get the equivalent of
the no-allocation versions of Ge
It compiles to
lift f d = f (d `cast` blah)
which seems fine to me. Are you unhappy 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
S
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