Copyright | (c) Christopher Chalmers |
---|---|

License | BSD3 |

Maintainer | Christopher Chalmers |

Stability | provisional |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

Stencils can be used to sum (or any fold) over neighbouring sites to
the current position on a `Focused`

.

# The Stencil type

Stencils are used to fold over neighbouring array sites. To
construct a stencil use `mkStencil`

, `mkStencilUnboxed`

. For
static sized stencils you can use the quasiquoter
`stencil`

.

To use a stencil you can use `stencilSum`

or use the `Foldable`

and
`FoldableWithIndex`

instances.

#### Instances

Functor (Stencil f) Source # | |

Foldable (Stencil f) Source # | |

Defined in Data.Dense.Stencil fold :: Monoid m => Stencil f m -> m # foldMap :: Monoid m => (a -> m) -> Stencil f a -> m # foldMap' :: Monoid m => (a -> m) -> Stencil f a -> m # foldr :: (a -> b -> b) -> b -> Stencil f a -> b # foldr' :: (a -> b -> b) -> b -> Stencil f a -> b # foldl :: (b -> a -> b) -> b -> Stencil f a -> b # foldl' :: (b -> a -> b) -> b -> Stencil f a -> b # foldr1 :: (a -> a -> a) -> Stencil f a -> a # foldl1 :: (a -> a -> a) -> Stencil f a -> a # toList :: Stencil f a -> [a] # length :: Stencil f a -> Int # elem :: Eq a => a -> Stencil f a -> Bool # maximum :: Ord a => Stencil f a -> a # minimum :: Ord a => Stencil f a -> a # | |

FoldableWithIndex (f Int) (Stencil f) Source # | |

Defined in Data.Dense.Stencil ifoldMap :: Monoid m => (f Int -> a -> m) -> Stencil f a -> m # ifolded :: IndexedFold (f Int) (Stencil f a) a # ifoldr :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b # ifoldl :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b # ifoldr' :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b # ifoldl' :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b # | |

(Show1 f, Show a) => Show (Stencil f a) Source # | |

mkStencil :: [(f Int, a)] -> Stencil f a Source #

Make a stencil folding over a list.

If the list is staticlly known this should expand at compile time
via rewrite rules, similar to `makeStencilTH`

but less reliable. If
that does not happen the resulting could be slow. If the list is
not know at compile time, `mkStencilUnboxed`

can be signifcantly
faster (but isn't subject expending via rewrite rules).

mkStencilUnboxed :: (Unbox (f Int), Unbox a) => [(f Int, a)] -> Stencil f a Source #

Make a stencil folding over an unboxed vector from the list.