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.
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.