[vector] #80: Improve Data instance

vector vector at projects.haskell.org
Mon Jul 23 14:49:29 BST 2012


#80: Improve Data instance
-------------------+--------------------------------------------------------
Reporter:  rl      |       Owner:     
    Type:  defect  |      Status:  new
Priority:  major   |   Milestone:     
 Version:          |    Keywords:     
-------------------+--------------------------------------------------------
 The current Data instance for vectors doesn't define toConstr and gunfold.
 This breaks some libraries, most notable uniplate. We should define the
 Data instance like this:

 {{{
 instance ... => Data (Vector a) where
   gunfold k z c
     | constrIndex c == 1 = k (z fromList)
     | otherwise = error ...

   toConstr v = v `seq` vConstr

   dataTypeOf _ = vType

 vConstr = mkConstr vType "fromList" [] Prefix
 vType = mkDataType "Vector" [vConstr]
 }}}

-- 
Ticket URL: <http://trac.haskell.org/vector/ticket/80>
vector <http://trac.haskell.org/vector>
Package vector


More information about the vector mailing list