Haskell vector variables do not have display, collapse, etc ... functions of a higher level?

When using mutable vectors for the first time, I found that while it Data.Vector.Unboxedhas all the higher level functions that you would expect as map, foldetc., the mutable version Data.Vector.Unboxed.Mutabledoes not have any of these. Trying to use functions from an immutable package on mutable vectors did not work.

What is the reason that a volatile vector package lacks many higher-level functions?

+4
source share
1 answer

, , , , .

, ints, (* 2) , . , ? , , , , . :

main = do
  v <- V.replicate 3 1
  let doubled = map (* 2) v
  putStrLn "First doubled number is: " ++ show (head doubled)
  set v 10
  putStrLn "Sum of doubled numbers is: " ++ show (sum doubled)

, , thunks , doubled 2, , , 10, doubled 20, 42: , . , , , , map .

+3

All Articles