Data.ArrayView
- Package
- purescript-array-views
- Repository
- 8084/purescript-array-views
#toUnfoldable Source
toUnfoldable :: forall f. Unfoldable f => ArrayView ~> f#modifyAtIndices Source
modifyAtIndices :: forall a t. Foldable t => t Int -> (a -> a) -> ArrayView a -> ArrayView a#filterA Source
filterA :: forall f a. Applicative f => (a -> f Boolean) -> ArrayView a -> f (ArrayView a)#groupBy Source
groupBy :: forall a. (a -> a -> Boolean) -> ArrayView a -> ArrayView (NonEmptyArrayView a)#intersectBy Source
intersectBy :: forall a. (a -> a -> Boolean) -> ArrayView a -> ArrayView a -> ArrayView a#zipWithA Source
zipWithA :: forall c b a m. Applicative m => (a -> b -> m c) -> ArrayView a -> ArrayView b -> m (ArrayView c)Re-exports from Data.Array
#scanr Source
scanr :: forall f b a. Traversable f => (a -> b -> b) -> b -> f a -> f bFold a data structure from the right, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's Prelude.scanr).
scanr (+) 0 [1,2,3] = [6,5,3]
scanr (flip (-)) 10 [1,2,3] = [4,5,7]
#scanl Source
scanl :: forall f b a. Traversable f => (b -> a -> b) -> b -> f a -> f bFold a data structure from the left, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's Prelude.scanl).
scanl (+) 0 [1,2,3] = [1,3,6]
scanl (-) 10 [1,2,3] = [9,7,4]
#intercalate Source
intercalate :: forall m f. Foldable f => Monoid m => m -> f m -> mFold a data structure, accumulating values in some Monoid,
combining adjacent elements using the specified separator.
For example:
> intercalate ", " ["Lorem", "ipsum", "dolor"]
= "Lorem, ipsum, dolor"
> intercalate "*" ["a", "b", "c"]
= "a*b*c"
> intercalate [1] [[2, 3], [4, 5], [6, 7]]
= [2, 3, 1, 4, 5, 1, 6, 7]
#any Source
any :: forall f b a. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> bany f is the same as or <<< map f; map a function over the structure,
and then get the disjunction of the results.
#all Source
all :: forall f b a. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> ball f is the same as and <<< map f; map a function over the structure,
and then get the conjunction of the results.
Re-exports from Data.ArrayView.Internal
#ArrayView Source
newtype ArrayView aInstances
Newtype (ArrayView a) _Generic (ArrayView a) _(Show a) => Show (ArrayView a)(Eq a) => Eq (ArrayView a)Eq1 ArrayView(Ord a) => Ord (ArrayView a)Ord1 ArrayViewFunctor ArrayViewApply ArrayViewBind ArrayViewApplicative ArrayViewMonad ArrayViewFunctorWithIndex Int ArrayViewFoldableWithIndex Int ArrayViewTraversableWithIndex Int ArrayViewFoldable ArrayViewTraversable ArrayViewUnfoldable1 ArrayViewUnfoldable ArrayViewSemigroup (ArrayView a)Monoid (ArrayView a)Alt ArrayViewPlus ArrayViewAlternative ArrayViewExtend ArrayViewMonadZero ArrayViewMonadPlus ArrayView(ArrayToView a b) => ArrayToView (Array a) (ArrayView b)(ArrayToView a b) => ArrayToView (ArrayView a) (Array b)
#ArrayToView Source
class ArrayToView a b whereThis typeclass allows to convert any function that operates on Array to a
function that operates on ArrayView and vice versa. use only inserts
fromArray and toArray in the right places, so don't expect it to
increase performance.
Note: either type annotation or partial application of some number of arguments is needed, because otherwise the type inference will not be able to guess the correct type.
import Data.Array as A
-- OK
zipWith :: forall a b c. (a -> b -> c) -> ArrayView a -> ArrayView b -> ArrayView c
zipWith = use (A.zipWith :: (a -> b -> c) -> Array a -> Array b -> Array c)
-- OK
zipWith :: forall a b c. (a -> b -> c) -> ArrayView a -> ArrayView b -> ArrayView c
zipWith f = use (A.zipWith f) -- all three type parameters are tied to `f`
-- Type error
zipWith :: forall a b c. (a -> b -> c) -> ArrayView a -> ArrayView b -> ArrayView c
zipWith = use A.zipWith
Members
use :: a -> b
Instances
ArrayToView a a(ArrayToView b a, ArrayToView c d) => ArrayToView (a -> c) (b -> d)(ArrayToView a b) => ArrayToView (Array a) (ArrayView b)(ArrayToView a b) => ArrayToView (ArrayView a) (Array b)(ArrayToView a b) => ArrayToView (NonEmptyArray a) (NonEmptyArrayView b)(ArrayToView a b) => ArrayToView (NonEmptyArrayView a) (NonEmptyArray b)(ArrayToView a b, ArrayToView c d) => ArrayToView (Tuple a c) (Tuple b d)(Functor f, ArrayToView a b) => ArrayToView (f a) (f b)