splay-0.0.1: (UNTESTED) Generic splay-based sequence representation

Copyright(c) dramforever 2015
LicenseBSD3
Maintainerdramforever
Stabilityunstable
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe
LanguageHaskell2010

Data.Splay

Description

A generic sequence representation with arbitary annotations, for use as a base for implementations of various collection types

Synopsis

Documentation

data Splay s a Source

A representation of a sequence of values of type a using a splay tree, which can also contain measurements of type s.

Instances

Measured s a => Measured s (Splay s a) Source

This instance uses the cached measure if possible

class Monoid s => Measured s a | a -> s where Source

s is a measurement of a

Methods

measure :: a -> s Source

Instances

Measured s a => Measured s (Splay s a) Source

This instance uses the cached measure if possible

singleton :: Measured s a => a -> Splay s a Source

Construct a sequence of only one element

split :: Measured s a => (s -> Bool) -> Splay s a -> (Splay s a, Splay s a) Source

Split the sequence into two part: the longest prefix whose measure does not satisfy the predicate, and the rest of the sequence

The predicate must be monotonic. Note that False < True.

(><) :: Measured s a => Splay s a -> Splay s a -> Splay s a Source

Concatenate two sequences