Copyright | (c) Andrey Mulik 2020 |
---|---|
License | BSD-style |
Maintainer | work.a.mulik@gmail.com |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe |
Language | Haskell2010 |
SDP.Shaped provides advanced operations on Indexed
structures, generalized by Index
type.
Synopsis
- class Shaped s e where
- defaultRebound :: (Index i, Index j, Bordered2 s i e) => s i e -> s j e
- rebound :: Index i => s i e -> (i, i) -> s i e
- reshape :: (Index i, Index j) => s i e -> (j, j) -> s j e
- (!!) :: SubIndex i j => s i e -> (i :|: j) -> s j e
- slices :: SubIndex i j => s i e -> [s j e]
- unslice :: (Foldable f, SubIndex i j) => f (s j e) -> s i e
Shaped
class Shaped s e where Source #
Service class for structures with arbitrary bounds. Allows you to extract subsequences corresponding to index subranges.
defaultRebound :: (Index i, Index j, Bordered2 s i e) => s i e -> s j e Source #
rebound
with defaultBounds
.
rebound :: Index i => s i e -> (i, i) -> s i e Source #
Set new bounds of same type, may shrink.
reshape :: (Index i, Index j) => s i e -> (j, j) -> s j e Source #
Set new bounds, may shrink.
(!!) :: SubIndex i j => s i e -> (i :|: j) -> s j e Source #
es !! ij
returns subshape ij
of es
.
slices :: SubIndex i j => s i e -> [s j e] Source #
Returns list of es
subshapes.
unslice :: (Foldable f, SubIndex i j) => f (s j e) -> s i e Source #
Unslice subshapes.
Instances
(Bordered1 rep Int e, Split1 rep e) => Shaped (AnyBorder rep) e Source # | |
Defined in SDP.Templates.AnyBorder defaultRebound :: (Index i, Index j, Bordered2 (AnyBorder rep) i e) => AnyBorder rep i e -> AnyBorder rep j e Source # rebound :: Index i => AnyBorder rep i e -> (i, i) -> AnyBorder rep i e Source # reshape :: (Index i, Index j) => AnyBorder rep i e -> (j, j) -> AnyBorder rep j e Source # (!!) :: SubIndex i j => AnyBorder rep i e -> (i :|: j) -> AnyBorder rep j e Source # slices :: SubIndex i j => AnyBorder rep i e -> [AnyBorder rep j e] Source # unslice :: (Foldable f, SubIndex i j) => f (AnyBorder rep j e) -> AnyBorder rep i e Source # |