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 a v. 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 v a. Lazy (FingerTree v a)
#deep Source
deep :: forall a v. Monoid v => Measured a v => Digit a -> Lazy (FingerTree v (Node v a)) -> Digit a -> FingerTree v a
#eqFingerTree Source
eqFingerTree :: forall a v. Monoid v => Measured a v => Eq a => FingerTree v a -> FingerTree v a -> Boolean
#compareFingerTree Source
compareFingerTree :: forall a v. Monoid v => Measured a v => Ord a => FingerTree v a -> FingerTree v a -> Ordering
#cons Source
cons :: forall a v. Monoid v => Measured a v => a -> FingerTree v a -> FingerTree v a
#snoc Source
snoc :: forall a v. Monoid v => Measured a v => FingerTree v a -> a -> FingerTree v a
#consAll Source
consAll :: forall f a v. Monoid v => Measured a v => Foldable f => f a -> FingerTree v a -> FingerTree v a
#snocAll Source
snocAll :: forall f a v. Monoid v => Measured a v => Foldable f => FingerTree v a -> f a -> FingerTree v a
#toFingerTree Source
toFingerTree :: forall f a v. Monoid v => Measured a v => Foldable f => f a -> FingerTree v a
#viewL Source
viewL :: forall a v. Monoid v => Measured a v => FingerTree v a -> ViewL (FingerTree v) a
#deepL Source
deepL :: forall a v. Monoid v => Measured a v => Array a -> Lazy (FingerTree v (Node v a)) -> Digit a -> FingerTree v a
#tail Source
tail :: forall a v. Monoid v => Measured a v => FingerTree v a -> Maybe (FingerTree v a)
#viewR Source
viewR :: forall a v. Monoid v => Measured a v => FingerTree v a -> ViewR (FingerTree v) a
#deepR Source
deepR :: forall a v. Monoid v => Measured a v => Digit a -> Lazy (FingerTree v (Node v a)) -> Array a -> FingerTree v a
#init Source
init :: forall a v. Monoid v => Measured a v => FingerTree v a -> Maybe (FingerTree v a)
#app3 Source
app3 :: forall a v. Monoid v => Measured a v => FingerTree v a -> Array a -> FingerTree v a -> FingerTree v a
#append Source
append :: forall a v. Monoid v => Measured a v => FingerTree v a -> FingerTree v a -> FingerTree v a
#splitTree Source
splitTree :: forall a v. 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 a v. 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 a v. Monoid v => Measured a v => (a -> Boolean) -> FingerTree v a -> FingerTree v a
#unfoldLeft Source
unfoldLeft :: forall f a v. Unfoldable f => Monoid v => Measured a v => FingerTree v a -> f a
#unfoldRight Source
unfoldRight :: forall f a v. Unfoldable f => Monoid v => Measured a v => FingerTree v a -> f a
#fullyForce Source
fullyForce :: forall a v. 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