Case expressions in STG

William Knop william.knop.nospam at gmail.com
Thu Jun 19 23:08:59 UTC 2014


Ah, yes, that's what I meant. I see your point about your example, now.

Will


> On Jun 19, 2014, at 3:27 AM, Tom Ellis <tom-lists-ghc-devs at jaguarpaw.co.uk> wrote:
> 
>> On Wed, Jun 18, 2014 at 07:40:26PM -0400, William Knop wrote:
>> f = \x -> x
>> g = \x -> (x,1)
>> h = \x -> fst (g x)
>> i = \x -> case f of
>>  f -> True
>>  _ -> False
>> 
>> i f => True
>> i h => ?
>> 
>> If g isn't inlined into h and fst optimized out, wouldn't the head normal
>> form of f and h be different, and the comparison fail even though it
>> shouldn't?  Or should it?  I've taken function equality to be "f and g are
>> equal iff f x == g x, for all x."
> 
> You mean 'i = \x -> case x of' ...
> 
> Anyway, I'm not suggesting using case to *compare* functions, simply force
> their thunk before proceeding with a single default alternative.
> 
> Tom
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list