#5073: Add blockST for nested ST scopes
---------------------------------+------------------------------------------
    Reporter:  simonpj           |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.0.3       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by matthew.fluet):

 It does seem simple enough to add.  And I think it is a good building
 block (pun?) for other, more sophisticated scope handling mechanisms,
 along the lines that John alluded to.

 However, it does seem that it is more useful to move *computations* from
 one `ST` scope to another.  That is, as mentioned in the Region Monad
 paper
 by way of Simon, making the two primitives be:

 {{{
   blockST :: (forall r. ST (s,r) a) -> ST s a
   importST :: ST s a -> ST (s, r) a
 }}}

 `importVar` requires that you have your hands on all of the `STRef`-s,
 which
 makes it hard to abstract over computations.  `importST` seems to simply
 be
 the public face of the proposed `promoteState#` primitive.  (Is there a
 typo in the type of `promoteState#`?  The final `a` seems out of place.)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5073#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