Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
class (Ixed m, Enum (Index m)) => ChainLike m where Source #
Chain-like sequence, by default it is an array or a list
bounds :: m -> (Index m, Index m) Source #
assocs :: m -> [(Index m, IxValue m)] Source #
modify :: Index m -> (IxValue m -> IxValue m) -> m -> m Source #
modifyBefore :: Index m -> (IxValue m -> IxValue m) -> m -> m Source #
modifyAfter :: Index m -> (IxValue m -> IxValue m) -> m -> m Source #
unsafeRead :: m -> Index m -> IxValue m Source #
Instances
(//) :: Ix i => Array i e -> [(i, e)] -> Array i e infixl 9 #
Constructs an array identical to the first argument except that it has
been updated by the associations in the right argument.
For example, if m
is a 1-origin, n
by n
matrix, then
m//[((i,i), 0) | i <- [1..n]]
is the same matrix, except with the diagonal zeroed.
Repeated indices in the association list are handled as for array
:
Haskell 2010 specifies that the resulting array is undefined (i.e. bottom),
but GHC's implementation uses the last association for each index.