I think it would yield the same code in the end.  Maybe it was just seeking to avoid unnecessary clutter in a particularly common case (eg returning I# x).

 

Seems to have been introduce in

commit 731f53de7930c38b5023a871146bd0ec066edf3a

Author: simonpj <unknown>

   Fri Sep 17 09:15:44 1999 +0000

 

Simon

 

From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Spiwack, Arnaud
Sent: 05 September 2018 15:02
To: ghc-devs@haskell.org
Subject: Rational for the special case in mkWWcpr_help

 

Dear all,

 

The function mkWWcpr_help, which creates a wrapper and a worker after strictness analysis, has a special case when there is a single result of unlifted type:

 

Wrapper:     case (..call worker..) of x -> C x
Worker:      case (   ..body..    ) of C x -> x

 

But I don't understand how it is different from using (# #) as would result from the general case:

 

Wrapper:     case (..call worker..) of (# x #) -> C x
Worker:      case (   ..body..    ) of C x -> (# x #)

 

That is, my understanding of the latter is that it would yield the exact same code. I'm obviously missing something, I'd love to know what.

 

Best,

Arnaud