Data.Set.Ordered
- Package
- purescript-ordered-set
- Repository
- flip111/purescript-ordered-set
Like Data.Array but keeps unique values. Inspired by haskell's Data.Set.Ordered
Some of Data.Array's functions are not included because they don't make sense when there are already unique values: nub, nubEq, nubBy, replicate
For documentation of functions look in Data.Array
Help is appreciated for implementing the following functions and instances:
- Functions: some, many, concatMap, group, group', groupBy, findMin, findMax, map
- Instances: Apply, Bind, Traversable, Show, Ord, Monoid
#OSet Source
newtype OSet aInstances
(Eq a) => Eq (OSet a)(Eq a) => Semigroup (OSet a)Foldable OSet(EncodeJson a) => EncodeJson (OSet a)(DecodeJson a) => DecodeJson (OSet a)
#toUnfoldable Source
toUnfoldable :: forall f. Unfoldable f => OSet ~> f#deleteWith Source
deleteWith :: forall a. (a -> Boolean) -> OSet a -> OSet aDelete first element matching the predicate.
Re-exports from Data.Foldable
#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.Traversable
#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]
- Modules
- Data.
Set. Ordered