Safe Haskell | None |
---|---|

Language | Haskell2010 |

Various Vector based utility functions

- mapAccumMV :: Monad m => (acc -> x -> m (acc, y)) -> acc -> Stream m x -> Stream m y
- stride :: Vector v a => Int -> v a -> v a
- fill :: (PrimMonad m, Functor m, MVector vm a) => Bundle v a -> vm (PrimState m) a -> m ()
- copyInto :: (PrimMonad m, MVector vm a, Vector v a) => vm (PrimState m) a -> v a -> m ()
- vUnfoldr :: Vector v x => Int -> (acc -> (x, acc)) -> acc -> (v x, acc)
- vUnfoldrM :: (PrimMonad m, Vector v x) => Int -> (acc -> m (x, acc)) -> acc -> m (v x, acc)

# Documentation

:: Monad m | |

=> (acc -> x -> m (acc, y)) | The function |

-> acc | The initial accumulator |

-> Stream m x | The input stream |

-> Stream m y | The output stream |

Like mapAccumL but monadic and over vectors. Doesn't return the accumulator at the end because it doesn't seem to be possible to do this with the Stream datatype, making this function pretty useless.

Create a vector from another vector containing only the elements that occur every stride elements in the source vector.

:: (PrimMonad m, Functor m, MVector vm a) | |

=> Bundle v a | The input Stream |

-> vm (PrimState m) a | The mutable Vector to stream into |

-> m () |

Fill a mutable vector from a monadic stream. This appears to be missing from the Vector library.

:: (PrimMonad m, MVector vm a, Vector v a) | |

=> vm (PrimState m) a | The destination |

-> v a | The source |

-> m () |

Copy a Vector into a mutable vector

:: Vector v x | |

=> Int | Generates a vector with this size |

-> (acc -> (x, acc)) | The generator function |

-> acc | The initial value of the seed |

-> (v x, acc) | The (vector, final value of seed) result |

Similar to unfoldrN from the vector package but the generator function cannot terminate and it returns the final value of the seed in addition to the vector