patch applied (ghc): Require a bang pattern when unlifted types
are where/let bound; #3182
igloo at earth.li
Sat Apr 25 08:31:07 EDT 2009
On Sat, Apr 25, 2009 at 07:20:20PM +1000, Roman Leshchinskiy wrote:
> On 25/04/2009, at 17:32, Max Bolingbroke wrote:
> >2009/4/25 Roman Leshchinskiy <rl at cse.unsw.edu.au>:
> >>On 25/04/2009, at 04:20, Ian Lynagh wrote:
> >>>Fri Apr 24 05:47:54 PDT 2009 Ian Lynagh <igloo at earth.li>
> >>> * Require a bang pattern when unlifted types are where/let bound;
> >Yeah, I'm also not convinced about this change. The real ticket is
> >#2806. http://hackage.haskell.org/trac/ghc/ticket/2806
Ooops, sorrry about that.
> Thanks Max, I now understand the reasoning behind this change a bit
> better. However, I'm still not convinced that it is a good idea,
All in my opinion:
* The fact that you are even allowed to let/where-bind values with
unlifted type is surprising. Making it clearer that something odd is
going on is a good thing. If it were up to me I think I would disallow
* It would make sense to go even further. You should not be able to say
(g (f x)) where f returns an unlifted type, but would instead have to
say (case f x of !y -> g y).
* Making it less convenient to use unboxed values directly is not
necessarily a bad thing. I have the impression that people resort to
using them too readily. (I imagine that you're using them in dph code,
and that this point doesn't apply to that).
> As to uniformity and forgetting about patterns for the moment, this
> change breaks the following equality:
> let v = e1 in e2 = (\v -> e1) e2
> This is quite unfortunate, IMO.
Unlifted types break lots of things, e.g. beta reduction:
(\_ -> ()) (case 1 `div` 0 of GHC.Base.I# i -> i) = _|_
At least if you try to rewrite according to your above equation you will
get a compilation failure, rather than a change in semantics.
More information about the Cvs-ghc