#1349: Generalise the ! and UNPACK mechanism for data types, to unpack function
arguments
----------------------+-----------------------------------------------------
 Reporter:  simonpj   |          Owner:             
     Type:  task      |         Status:  new        
 Priority:  normal    |      Milestone:  6.10 branch
Component:  Compiler  |        Version:  6.6.1      
 Severity:  normal    |     Resolution:             
 Keywords:            |     Difficulty:  Unknown    
 Testcase:            |   Architecture:  Unknown    
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Comment (by Isaac Dupree):

 Strictness annotations in function results don't make sense (for the same
 reason `id` is strict -- function results are "already WHNF-strict" as
 much as it makes sense), and they're already lifted (in the sense that
 they can possibly produce _|_) even for unboxed result types (e.g. {{{bot
 :: () -> Int#; bot x = bot x}}}).  But unboxing a result-tuple can result
 in a loss of sharing, so in
 {{{
 newtype State s a
         = State
         { runState' :: s -> (# a, s #) }
 }}}
 the unboxedness of the tuple really is significant for efficiency reasons,
 to tell GHC that it doesn't need to preserve sharing. See
 http://www.nabble.com/there-isn%27t-any-difference%2C-is-there%2C-with-
 unboxed-tuples--to14629139.html

 So I also want a function-result-syntax of UNPACK, presumably without an
 intervening meaningless strictness annotation:
 {{{
 newtype State s a
         = State
         { runState' :: s -> {-# UNPACK #-} ( a, s ) }
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1349#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to