raz-0.1.0.0: Random Access Zippers

Safe HaskellNone
LanguageHaskell2010

Data.Raz.Core.Internal

Contents

Synopsis

Documentation

type Lev = Int Source #

type Cnt = Int Source #

data Dir Source #

Constructors

L 
R 

Instances

Eq Dir Source # 

Methods

(==) :: Dir -> Dir -> Bool #

(/=) :: Dir -> Dir -> Bool #

Ord Dir Source # 

Methods

compare :: Dir -> Dir -> Ordering #

(<) :: Dir -> Dir -> Bool #

(<=) :: Dir -> Dir -> Bool #

(>) :: Dir -> Dir -> Bool #

(>=) :: Dir -> Dir -> Bool #

max :: Dir -> Dir -> Dir #

min :: Dir -> Dir -> Dir #

Read Dir Source # 
Show Dir Source # 

Methods

showsPrec :: Int -> Dir -> ShowS #

show :: Dir -> String #

showList :: [Dir] -> ShowS #

data Tree a Source #

Constructors

Empty 
Leaf a 
Bin !Lev !Cnt !(Tree a) !(Tree a) 

Instances

Functor Tree Source # 

Methods

fmap :: (a -> b) -> Tree a -> Tree b #

(<$) :: a -> Tree b -> Tree a #

Foldable Tree Source # 

Methods

fold :: Monoid m => Tree m -> m #

foldMap :: Monoid m => (a -> m) -> Tree a -> m #

foldr :: (a -> b -> b) -> b -> Tree a -> b #

foldr' :: (a -> b -> b) -> b -> Tree a -> b #

foldl :: (b -> a -> b) -> b -> Tree a -> b #

foldl' :: (b -> a -> b) -> b -> Tree a -> b #

foldr1 :: (a -> a -> a) -> Tree a -> a #

foldl1 :: (a -> a -> a) -> Tree a -> a #

toList :: Tree a -> [a] #

null :: Tree a -> Bool #

length :: Tree a -> Int #

elem :: Eq a => a -> Tree a -> Bool #

maximum :: Ord a => Tree a -> a #

minimum :: Ord a => Tree a -> a #

sum :: Num a => Tree a -> a #

product :: Num a => Tree a -> a #

Traversable Tree Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Tree a -> f (Tree b) #

sequenceA :: Applicative f => Tree (f a) -> f (Tree a) #

mapM :: Monad m => (a -> m b) -> Tree a -> m (Tree b) #

sequence :: Monad m => Tree (m a) -> m (Tree a) #

Eq a => Eq (Tree a) Source # 

Methods

(==) :: Tree a -> Tree a -> Bool #

(/=) :: Tree a -> Tree a -> Bool #

Ord a => Ord (Tree a) Source # 

Methods

compare :: Tree a -> Tree a -> Ordering #

(<) :: Tree a -> Tree a -> Bool #

(<=) :: Tree a -> Tree a -> Bool #

(>) :: Tree a -> Tree a -> Bool #

(>=) :: Tree a -> Tree a -> Bool #

max :: Tree a -> Tree a -> Tree a #

min :: Tree a -> Tree a -> Tree a #

Read a => Read (Tree a) Source # 
Show a => Show (Tree a) Source # 

Methods

showsPrec :: Int -> Tree a -> ShowS #

show :: Tree a -> String #

showList :: [Tree a] -> ShowS #

data TList a Source #

Constructors

Nil 
Cons a !(TList a) 
Level Lev !(TList a) 
Tree !(Tree a) !(TList a) 

Instances

Functor TList Source # 

Methods

fmap :: (a -> b) -> TList a -> TList b #

(<$) :: a -> TList b -> TList a #

Foldable TList Source # 

Methods

fold :: Monoid m => TList m -> m #

foldMap :: Monoid m => (a -> m) -> TList a -> m #

foldr :: (a -> b -> b) -> b -> TList a -> b #

foldr' :: (a -> b -> b) -> b -> TList a -> b #

foldl :: (b -> a -> b) -> b -> TList a -> b #

foldl' :: (b -> a -> b) -> b -> TList a -> b #

foldr1 :: (a -> a -> a) -> TList a -> a #

foldl1 :: (a -> a -> a) -> TList a -> a #

toList :: TList a -> [a] #

null :: TList a -> Bool #

length :: TList a -> Int #

elem :: Eq a => a -> TList a -> Bool #

maximum :: Ord a => TList a -> a #

minimum :: Ord a => TList a -> a #

sum :: Num a => TList a -> a #

product :: Num a => TList a -> a #

Traversable TList Source # 

Methods

traverse :: Applicative f => (a -> f b) -> TList a -> f (TList b) #

sequenceA :: Applicative f => TList (f a) -> f (TList a) #

mapM :: Monad m => (a -> m b) -> TList a -> m (TList b) #

sequence :: Monad m => TList (m a) -> m (TList a) #

Eq a => Eq (TList a) Source # 

Methods

(==) :: TList a -> TList a -> Bool #

(/=) :: TList a -> TList a -> Bool #

Ord a => Ord (TList a) Source # 

Methods

compare :: TList a -> TList a -> Ordering #

(<) :: TList a -> TList a -> Bool #

(<=) :: TList a -> TList a -> Bool #

(>) :: TList a -> TList a -> Bool #

(>=) :: TList a -> TList a -> Bool #

max :: TList a -> TList a -> TList a #

min :: TList a -> TList a -> TList a #

type Raz a = (TList a, a, TList a) Source #

singleton :: a -> Raz a Source #

empty :: MonadRandom m => a -> m (Raz a) Source #

size :: Tree a -> Cnt Source #

trim :: Dir -> TList a -> TList a Source #

trim' :: Dir -> Tree a -> TList a -> TList a Source #

viewC :: Raz a -> a Source #

view :: Dir -> Raz a -> a Source #

view' :: Dir -> TList a -> a Source #

alterC :: a -> Raz a -> Raz a Source #

adjustC :: (a -> a) -> Raz a -> Raz a Source #

adjustC' :: (a -> a) -> Raz a -> Raz a Source #

alter :: Dir -> a -> Raz a -> Raz a Source #

alter' :: Dir -> a -> TList a -> TList a Source #

insert :: MonadRandom m => Dir -> a -> Raz a -> m (Raz a) Source #

remove :: Dir -> Raz a -> Raz a Source #

remove' :: Dir -> TList a -> (a, TList a) Source #

removeC :: Dir -> Raz a -> Raz a Source #

move :: Dir -> Raz a -> Raz a Source #

move' :: Dir -> TList a -> TList a -> Raz a Source #

focus :: Int -> Tree a -> Raz a Source #

focus' :: Int -> TList a -> TList a -> Tree a -> Raz a Source #

focusL :: Tree a -> Raz a Source #

focusL' :: TList a -> Tree a -> Raz a Source #

focusR :: Tree a -> Raz a Source #

focusR' :: TList a -> Tree a -> Raz a Source #

joinSides :: Tree a -> Tree a -> Tree a Source #

tail :: TList a -> TList a Source #

grow :: Dir -> TList a -> Tree a Source #

grow' :: Dir -> Tree a -> TList a -> Tree a Source #

unfocus :: Raz a -> Tree a Source #

fromList :: MonadRandom m => [a] -> m (Tree a) Source #

fromList' :: MonadRandom m => TList a -> [a] -> m (Tree a) Source #

push :: Lev -> TList a -> TList a Source #

fold :: TList a -> Tree a Source #

bin :: Lev -> Tree a -> Tree a -> Tree a Source #

Combinators

insertAt' :: MonadRandom m => Dir -> Int -> a -> Tree a -> m (Tree a) Source #

Displaying Raz

showRaz :: (a -> String) -> Raz a -> String Source #

treeToList :: Dir -> Tree a -> [a] -> [a] Source #

halfToList :: Dir -> TList a -> [a] -> [a] Source #

showTree :: (a -> String) -> Tree a -> String Source #