[vector] #54: Missing NFData instances for vector types

vector vector at projects.haskell.org
Sun Jan 29 12:51:55 GMT 2012


#54: Missing NFData instances for vector types
------------------------+---------------------------------------------------
Reporter:  hvr          |        Owner:          
    Type:  enhancement  |       Status:  reopened
Priority:  blocker      |    Milestone:  0.10    
 Version:  0.7          |   Resolution:          
Keywords:               |  
------------------------+---------------------------------------------------

Comment(by basvandijk):

 Oops! Well spotted Roman!

 I think there should also be a functional dependency from `a` to `m` (or
 an associated type family) like:

 {{{
 class NFDataM a m | a -> m where
   rnfM :: a -> m ()
 }}}

 So that we can define:

 {{{
 instance NFDataM  (MVector s a) (ST s) where
   rnfM (MVector i n arr) = force i
         where
           force !ix | ix < n    = do x <- readArray arr ix
                                      rnf x `seq` force (ix+1)
                     | otherwise = return ()
 }}}

-- 
Ticket URL: <http://trac.haskell.org/vector/ticket/54#comment:21>
vector <http://trac.haskell.org/vector>
Package vector


More information about the vector mailing list