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

Language | Haskell2010 |

- class ForEach m c where
- type ForEachValue c
- type ForEachIx c
- forEach :: Unrolling (UnTL n) => Unroll n -> c -> m (ForEachValue c)
- iforEach :: Unrolling (UnTL n) => Unroll n -> c -> m (ForEachIx c, ForEachValue c)

- forEachVector :: (Monad m, Vector v a, Unrolling (UnTL n)) => Unroll n -> v a -> LoopT m a
- iforEachVector :: (Monad m, Vector v a, Unrolling (UnTL n)) => Unroll n -> v a -> LoopT m (Int, a)
- forEachMVector :: (PrimMonad m, MVector v a, Unrolling (UnTL n)) => Unroll n -> v (PrimState m) a -> LoopT m a
- iforEachMVector :: (PrimMonad m, MVector v a, Unrolling (UnTL n)) => Unroll n -> v (PrimState m) a -> LoopT m (Int, a)

# Documentation

class ForEach m c where Source

Class of containers that can be iterated over. The class is parameterized over a base monad where the values of the container can be read to allow iterating over mutable structures. The associated type families parameterize the value and index types of the container, allowing the class to be instantiated for container types (unboxed or storable vectors, for example) which do not admit all types as values.

type ForEachValue c Source

forEach :: Unrolling (UnTL n) => Unroll n -> c -> m (ForEachValue c) Source

Iterate over the values in the container.

iforEach :: Unrolling (UnTL n) => Unroll n -> c -> m (ForEachIx c, ForEachValue c) Source

Iterate over the indices and the value at each index.

(Monad m, Storable a) => ForEach (LoopT * m) (Vector a) | |

(Monad m, Prim a) => ForEach (LoopT * m) (Vector a) | |

(Monad m, Unbox a) => ForEach (LoopT * m) (Vector a) | |

Monad m => ForEach (LoopT * m) (Vector a) | |

Monad m => ForEach (LoopT * m) [a] | |

(Storable a, PrimMonad m, (~) * (PrimState m) s) => ForEach (LoopT * m) (MVector s a) | |

(PrimMonad m, Prim a, (~) * (PrimState m) s) => ForEach (LoopT * m) (MVector s a) | |

(PrimMonad m, Unbox a, (~) * (PrimState m) s) => ForEach (LoopT * m) (MVector s a) | |

(PrimMonad m, (~) * (PrimState m) s) => ForEach (LoopT * m) (MVector s a) |

iforEachVector :: (Monad m, Vector v a, Unrolling (UnTL n)) => Unroll n -> v a -> LoopT m (Int, a) Source