Data.FingerTree
- Package
- purescript-sequences
- Repository
- hdgarrood/purescript-sequences
This module defines a general-purpose data structure, known as a "finger
tree", which is intended to be used as a building block for implementing
other data structures. See, for example, Seq
from Data.Sequence
.
#nodeToDigit Source
nodeToDigit :: forall v a. Node v a -> Digit a
#FingerTree Source
data FingerTree v a
Constructors
Instances
(Show v, Show a) => Show (FingerTree v a)
(Monoid v, Measured a v) => Semigroup (FingerTree v a)
Functor (FingerTree v)
Foldable (FingerTree v)
Traversable (FingerTree v)
(Monoid v, Measured a v) => Measured (FingerTree v a) v
#lazyEmpty Source
lazyEmpty :: forall a v. Lazy (FingerTree v a)
#deep Source
deep :: forall v a. Monoid v => Measured a v => Digit a -> Lazy (FingerTree v (Node v a)) -> Digit a -> FingerTree v a
#eqFingerTree Source
eqFingerTree :: forall v a. Monoid v => Measured a v => Eq a => FingerTree v a -> FingerTree v a -> Boolean
#compareFingerTree Source
compareFingerTree :: forall v a. Monoid v => Measured a v => Ord a => FingerTree v a -> FingerTree v a -> Ordering
#cons Source
cons :: forall v a. Monoid v => Measured a v => a -> FingerTree v a -> FingerTree v a
#snoc Source
snoc :: forall v a. Monoid v => Measured a v => FingerTree v a -> a -> FingerTree v a
#consAll Source
consAll :: forall v a f. Monoid v => Measured a v => Foldable f => f a -> FingerTree v a -> FingerTree v a
#snocAll Source
snocAll :: forall v a f. Monoid v => Measured a v => Foldable f => FingerTree v a -> f a -> FingerTree v a
#toFingerTree Source
toFingerTree :: forall v a f. Monoid v => Measured a v => Foldable f => f a -> FingerTree v a
#viewL Source
viewL :: forall v a. Monoid v => Measured a v => FingerTree v a -> ViewL (FingerTree v) a
#deepL Source
deepL :: forall v a. Monoid v => Measured a v => Array a -> Lazy (FingerTree v (Node v a)) -> Digit a -> FingerTree v a
#tail Source
tail :: forall v a. Monoid v => Measured a v => FingerTree v a -> Maybe (FingerTree v a)
#viewR Source
viewR :: forall v a. Monoid v => Measured a v => FingerTree v a -> ViewR (FingerTree v) a
#deepR Source
deepR :: forall v a. Monoid v => Measured a v => Digit a -> Lazy (FingerTree v (Node v a)) -> Array a -> FingerTree v a
#init Source
init :: forall v a. Monoid v => Measured a v => FingerTree v a -> Maybe (FingerTree v a)
#app3 Source
app3 :: forall v a. Monoid v => Measured a v => FingerTree v a -> Array a -> FingerTree v a -> FingerTree v a
#append Source
append :: forall v a. Monoid v => Measured a v => FingerTree v a -> FingerTree v a -> FingerTree v a
#splitTree Source
splitTree :: forall v a. Monoid v => Measured a v => Partial => (v -> Boolean) -> v -> FingerTree v a -> LazySplit (FingerTree v) a
This function throws an error if the argument is empty.
#split Source
split :: forall v a. Monoid v => Measured a v => Partial => (v -> Boolean) -> FingerTree v a -> Tuple (Lazy (FingerTree v a)) (Lazy (FingerTree v a))
Split a finger tree according to which elements satisfy a predicate. This function is partial because it requires that the result of applying the predicate to mempty is false; if this is not the case, the behaviour is undefined.
#filter Source
filter :: forall v a. Monoid v => Measured a v => (a -> Boolean) -> FingerTree v a -> FingerTree v a
#unfoldLeft Source
unfoldLeft :: forall v a f. Unfoldable f => Monoid v => Measured a v => FingerTree v a -> f a
#unfoldRight Source
unfoldRight :: forall v a f. Unfoldable f => Monoid v => Measured a v => FingerTree v a -> f a
#fullyForce Source
fullyForce :: forall v a. FingerTree v a -> FingerTree v a
Re-exports from Data.FingerTree.Digit
#Digit Source
newtype Digit a
A Digit is just an array which has between one and four elements (inclusive). If a Digit has two or three elements, it is described as 'safe'; otherwise, it is described as 'dangerous'.
Instances
#mkDigitMay Source
mkDigitMay :: forall a. Array a -> Maybe (Digit a)
Like mkDigit, except this returns Nothing on invalid input.
#digitLength Source
digitLength :: forall a. Digit a -> Int