Make SpecConstr specialise for constant arguments again
Make SpecConstr specialise for constant arguments again

Consider
  lvl = Just True

  foo :: Maybe Bool -> Int -> Int
  foo (Just True) i = i
  foo _           i = foo lvl i

SpecConstr should specialise foo, but it wasn't doing so (spotted
by Roman).

Reason: lvl's unfolding wasn't in the cloned version of lvl.
Solution: extend the value environment to record top-level bindings too

At the same time I made it work if 'lvl' is a lambda, in which case it
is again worth specialisg.  This meant renaming ConEnv to ValueEnv,
and adding a case for 'LambdaVal'.

(To make specialisation on lambdas work properly, we have to do lambda
lifting as well, but this gets part of the way, and fixes a bug too.)



tibbe/ghc,mfine/ghc,da-x/ghc,elieux/ghc,ilyasergey/GHC-XAppFix,da-x/ghc,fmthoma/ghc,AlexanderPankiv/ghc,tjakway/ghcjvm,mcschroeder/ghc,gridaphobe/ghc,sgillespie/ghc,gcampax/ghc,vikraman/ghc,sgillespie/ghc,hferreiro/replay,green-haskell/ghc,ekmett/ghc,vikraman/ghc,gridaphobe/ghc,bitemyapp/ghc,ezyang/ghc,green-haskell/ghc,anton-dessiatov/ghc,olsner/ghc,christiaanb/ghc,oldmanmike/ghc,ekmett/ghc,mcschroeder/ghc,GaloisInc/halvm-ghc,fmthoma/ghc,gcampax/ghc,anton-dessiatov/ghc,vTurbine/ghc,anton-dessiatov/ghc,frantisekfarka/ghc-dsi,mcschroeder/ghc,elieux/ghc,ryantm/ghc,wxwxwwxxx/ghc,fmthoma/ghc,vikraman/ghc,nkaretnikov/ghc,jstolarek/ghc,wxwxwwxxx/ghc,tjakway/ghcjvm,vTurbine/ghc,oldmanmike/ghc,nkaretnikov/ghc,nkaretnikov/ghc,ml9951/ghc,oldmanmike/ghc,nushio3/ghc,olsner/ghc,sgillespie/ghc,ml9951/ghc,gridaphobe/ghc,lukexi/ghc,urbanslug/ghc,shlevy/ghc,acowley/ghc,fmthoma/ghc,mettekou/ghc,ekmett/ghc,tjakway/ghcjvm,olsner/ghc,wxwxwwxxx/ghc,bitemyapp/ghc,nkaretnikov/ghc,nkaretnikov/ghc,christiaanb/ghc,acowley/ghc,nathyong/microghc-ghc,AlexanderPankiv/ghc,anton-dessiatov/ghc,elieux/ghc,shlevy/ghc,tjakway/ghcjvm,sgillespie/ghc,olsner/ghc,hferreiro/replay,ezyang/ghc,nushio3/ghc,anton-dessiatov/ghc,gcampax/ghc,snoyberg/ghc,lukexi/ghc-7.8-arm64,vTurbine/ghc,vikraman/ghc,urbanslug/ghc,urbanslug/ghc,tibbe/ghc,christiaanb/ghc,shlevy/ghc,GaloisInc/halvm-ghc,tibbe/ghc,ezyang/ghc,mcmaniac/ghc,tjakway/ghcjvm,da-x/ghc,elieux/ghc,siddhanathan/ghc,oldmanmike/ghc,oldmanmike/ghc,ghc-android/ghc,TomMD/ghc,gcampax/ghc,fmthoma/ghc,mcmaniac/ghc,ml9951/ghc,gridaphobe/ghc,nomeata/ghc,anton-dessiatov/ghc,ezyang/ghc,sdiehl/ghc,green-haskell/ghc,gridaphobe/ghc,acowley/ghc,nathyong/microghc-ghc,nkaretnikov/ghc,anton-dessiatov/ghc,siddhanathan/ghc,ghc-android/ghc,TomMD/ghc,oldmanmike/ghc,lukexi/ghc-7.8-arm64,da-x/ghc,sdiehl/ghc,urbanslug/ghc,forked-upstream-packages-for-ghcjs/ghc,ezyang/ghc,snoyberg/ghc,TomMD/ghc,gridaphobe/ghc,vikraman/ghc,ezyang/ghc,lukexi/ghc-7.8-arm64,shlevy/ghc,tjakway/ghcjvm,lukexi/ghc,lukexi/ghc-7.8-arm64,AlexanderPankiv/ghc,mfine/ghc,vTurbine/ghc,nathyong/microghc-ghc,wxwxwwxxx/ghc,ghc-android/ghc,forked-upstream-packages-for-ghcjs/ghc,AlexanderPankiv/ghc,da-x/ghc,sdiehl/ghc,holzensp/ghc,wxwxwwxxx/ghc,bitemyapp/ghc,sdiehl/ghc,nkaretnikov/ghc,acowley/ghc,mettekou/ghc,AlexanderPankiv/ghc,olsner/ghc,mcschroeder/ghc,gcampax/ghc,shlevy/ghc,vTurbine/ghc,ml9951/ghc,sgillespie/ghc,ghc-android/ghc,snoyberg/ghc,bitemyapp/ghc,frantisekfarka/ghc-dsi,mettekou/ghc,ryantm/ghc,sgillespie/ghc,nomeata/ghc,holzensp/ghc,mcschroeder/ghc,ryantm/ghc,nathyong/microghc-ghc,sdiehl/ghc,da-x/ghc,mfine/ghc,mettekou/ghc,nushio3/ghc,hferreiro/replay,tibbe/ghc,GaloisInc/halvm-ghc,spacekitteh/smcghc,green-haskell/ghc,siddhanathan/ghc,da-x/ghc,wxwxwwxxx/ghc,sgillespie/ghc,AlexanderPankiv/ghc,fmthoma/ghc,urbanslug/ghc,forked-upstream-packages-for-ghcjs/ghc,lukexi/ghc,mfine/ghc,lukexi/ghc,gcampax/ghc,spacekitteh/smcghc,olsner/ghc,vTurbine/ghc,ekmett/ghc,nomeata/ghc,mettekou/ghc,ekmett/ghc,ghc-android/ghc,urbanslug/ghc,lukexi/ghc-7.8-arm64,urbanslug/ghc,nathyong/microghc-ghc,sdiehl/ghc,ilyasergey/GHC-XAppFix,christiaanb/ghc,holzensp/ghc,vTurbine/ghc,ryantm/ghc,GaloisInc/halvm-ghc,acowley/ghc,vikraman/ghc,christiaanb/ghc,spacekitteh/smcghc,frantisekfarka/ghc-dsi,siddhanathan/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,acowley/ghc,nomeata/ghc,lukexi/ghc,mcmaniac/ghc,mcschroeder/ghc,nomeata/ghc,nathyong/microghc-ghc,mfine/ghc,frantisekfarka/ghc-dsi,jstolarek/ghc,elieux/ghc,snoyberg/ghc,mettekou/ghc,snoyberg/ghc,green-haskell/ghc,gridaphobe/ghc,forked-upstream-packages-for-ghcjs/ghc,ryantm/ghc,nushio3/ghc,nathyong/microghc-ghc,ezyang/ghc,mcmaniac/ghc,AlexanderPankiv/ghc,ilyasergey/GHC-XAppFix,mfine/ghc,olsner/ghc,mfine/ghc,elieux/ghc,forked-upstream-packages-for-ghcjs/ghc,vikraman/ghc,ml9951/ghc,GaloisInc/halvm-ghc,ml9951/ghc,bitemyapp/ghc,ghc-android/ghc,sdiehl/ghc,TomMD/ghc,shlevy/ghc,ghc-android/ghc,tjakway/ghcjvm,snoyberg/ghc,fmthoma/ghc,siddhanathan/ghc,spacekitteh/smcghc,hferreiro/replay,GaloisInc/halvm-ghc,acowley/ghc,nushio3/ghc,ilyasergey/GHC-XAppFix,mcmaniac/ghc,jstolarek/ghc,TomMD/ghc,forked-upstream-packages-for-ghcjs/ghc,elieux/ghc,nushio3/ghc,mettekou/ghc,christiaanb/ghc,nushio3/ghc,frantisekfarka/ghc-dsi,snoyberg/ghc,gcampax/ghc,mcschroeder/ghc,jstolarek/ghc,holzensp/ghc,siddhanathan/ghc,TomMD/ghc,tibbe/ghc,GaloisInc/halvm-ghc,spacekitteh/smcghc,hferreiro/replay,siddhanathan/ghc,oldmanmike/ghc,shlevy/ghc,ml9951/ghc,holzensp/ghc,jstolarek/ghc,wxwxwwxxx/ghc,christiaanb/ghc,TomMD/ghc,hferreiro/replay,hferreiro/replay