#1349: Generalise the ! and UNPACK mechanism for data types, to unpack function
arguments
---------------------------------+------------------------------------------
    Reporter:  simonpj           |        Owner:              
        Type:  task              |       Status:  new         
    Priority:  normal            |    Milestone:  6.12.3      
   Component:  Compiler          |      Version:  6.6.1       
    Keywords:                    |   Difficulty:  Unknown     
          Os:  Unknown/Multiple  |     Testcase:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by simonpj):

 OK I get the idea.  But there are a number of corners.  For example:
   * If I have a function of type `(!Int -> Int)` can I pass it to a
 function expecting an argument of type `(Int -> Int)`.  Perhaps yes, with
 some automatic impedence matching?

   * If there is automatic impedence matching might I lose sharing?
 Example: suppose
 {{{
 f :: Int -> !Int -> Int
 g :: (Int -> Int -> Int) -> Int
 }}}
   If GHC sees `(g f)` in source code, should it transform to `(g (\xy.
 case y of I# y# -> g x y#))`?  Tha might lose sharing if `(f x)` did a lot
 of computation before returning a function.

   * Does the type `!a -> a` make sense?  It does for data constructors.

   * An implementation question is this: how should these bang types be
 represented? Is there a new type constructor for "!"?  Is `(!Int -> Int)`
 different to `(Int# -> Int)` or not?

 A good framework to think of this in is Max's paper
 [http://www.cl.cam.ac.uk/~mb566/papers/tacc-hs09.pdf Types are calling
 conventions].

 I doubt I'm going to move fast on this, I'm afraid.

 Simon

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

Reply via email to