-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Random Access Zippers -- -- Please see README.md @package raz @version 0.1.0.0 module Data.Raz.Core.Internal type Lev = Int type Cnt = Int data Dir L :: Dir R :: Dir data Tree a Empty :: Tree a Leaf :: a -> Tree a Bin :: !Lev -> !Cnt -> !(Tree a) -> !(Tree a) -> Tree a data TList a Nil :: TList a Cons :: a -> !(TList a) -> TList a Level :: Lev -> !(TList a) -> TList a Tree :: !(Tree a) -> !(TList a) -> TList a type Raz a = (TList a, a, TList a) randomLevel :: MonadRandom m => m Lev singleton :: a -> Raz a empty :: MonadRandom m => a -> m (Raz a) size :: Tree a -> Cnt trim :: Dir -> TList a -> TList a trim' :: Dir -> Tree a -> TList a -> TList a viewC :: Raz a -> a view :: Dir -> Raz a -> a view' :: Dir -> TList a -> a alterC :: a -> Raz a -> Raz a adjustC :: (a -> a) -> Raz a -> Raz a adjustC' :: (a -> a) -> Raz a -> Raz a alter :: Dir -> a -> Raz a -> Raz a alter' :: Dir -> a -> TList a -> TList a insert :: MonadRandom m => Dir -> a -> Raz a -> m (Raz a) remove :: Dir -> Raz a -> Raz a remove' :: Dir -> TList a -> (a, TList a) removeC :: Dir -> Raz a -> Raz a move :: Dir -> Raz a -> Raz a move' :: Dir -> TList a -> TList a -> Raz a focus :: Int -> Tree a -> Raz a focus' :: Int -> TList a -> TList a -> Tree a -> Raz a focusL :: Tree a -> Raz a focusL' :: TList a -> Tree a -> Raz a focusR :: Tree a -> Raz a focusR' :: TList a -> Tree a -> Raz a joinSides :: Tree a -> Tree a -> Tree a headAsTree :: TList a -> Tree a tail :: TList a -> TList a grow :: Dir -> TList a -> Tree a grow' :: Dir -> Tree a -> TList a -> Tree a unfocus :: Raz a -> Tree a fromList :: MonadRandom m => [a] -> m (Tree a) fromList' :: MonadRandom m => TList a -> [a] -> m (Tree a) push :: Lev -> TList a -> TList a fold :: TList a -> Tree a bin :: Lev -> Tree a -> Tree a -> Tree a insertAt' :: MonadRandom m => Dir -> Int -> a -> Tree a -> m (Tree a) showRaz :: (a -> String) -> Raz a -> String treeToList :: Dir -> Tree a -> [a] -> [a] halfToList :: Dir -> TList a -> [a] -> [a] showTree :: (a -> String) -> Tree a -> String instance Data.Traversable.Traversable Data.Raz.Core.Internal.TList instance Data.Foldable.Foldable Data.Raz.Core.Internal.TList instance GHC.Base.Functor Data.Raz.Core.Internal.TList instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Raz.Core.Internal.TList a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Raz.Core.Internal.TList a) instance Data.Traversable.Traversable Data.Raz.Core.Internal.Tree instance Data.Foldable.Foldable Data.Raz.Core.Internal.Tree instance GHC.Base.Functor Data.Raz.Core.Internal.Tree instance GHC.Read.Read Data.Raz.Core.Internal.Dir instance GHC.Show.Show Data.Raz.Core.Internal.Dir instance GHC.Classes.Ord Data.Raz.Core.Internal.Dir instance GHC.Classes.Eq Data.Raz.Core.Internal.Dir instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Raz.Core.Internal.Tree a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Raz.Core.Internal.Tree a) instance GHC.Show.Show a => GHC.Show.Show (Data.Raz.Core.Internal.Tree a) instance GHC.Read.Read a => GHC.Read.Read (Data.Raz.Core.Internal.Tree a) module Data.Raz.Core.Sequence cons :: MonadRandom m => a -> Tree a -> m (Tree a) snoc :: MonadRandom m => Tree a -> a -> m (Tree a) append :: MonadRandom m => Tree a -> Tree a -> m (Tree a) replicate :: MonadRandom m => Int -> a -> m (Tree a) -- | O(n*log n). The sequence of suffixes of a sequence. tails :: MonadRandom m => Tree a -> m (Tree (Tree a)) -- | A generalization of tails where the suffixes are passed to a -- monadic continuation, recording their results. tailsWith :: MonadRandom m => (Tree a -> m b) -> Tree a -> m (Tree b) -- | O(n*log n). The sequence of non-empty suffixes of a sequence. -- -- The underlying tree structure is reused to represent the overall -- sequence, as well as every suffix, which might exacerbate worst case -- situations. tailsWith' :: Applicative m => (Tree a -> m b) -> Tree a -> m (Tree b) takeWhileL :: (a -> Bool) -> Tree a -> Tree a takeWhileR :: (a -> Bool) -> Tree a -> Tree a dropWhileL :: (a -> Bool) -> Tree a -> Tree a dropWhileR :: (a -> Bool) -> Tree a -> Tree a spanL :: (a -> Bool) -> Tree a -> (Tree a, Tree a) spanR :: (a -> Bool) -> Tree a -> (Tree a, Tree a) breakL :: (a -> Bool) -> Tree a -> (Tree a, Tree a) breakR :: (a -> Bool) -> Tree a -> (Tree a, Tree a) partition :: (a -> Bool) -> Tree a -> (Tree a, Tree a) partition' :: (a -> Bool) -> Tree a -> (TList a, TList a) partition'' :: (a -> Bool) -> Lev -> Tree a -> (TList a, TList a) -> (TList a, TList a) filter :: (a -> Bool) -> Tree a -> Tree a -- | log(n). The element at the specified position, counting from 0. lookup :: Int -> Tree a -> Maybe a (!?) :: Tree a -> Int -> Maybe a index :: Tree a -> Int -> a adjust :: (a -> a) -> Int -> Tree a -> Tree a adjust' :: (a -> a) -> Int -> Tree a -> Tree a update :: Int -> a -> Tree a -> Tree a -- | Helper function for checking bounds. checked :: Int -> (Tree a -> b) -> b -> Tree a -> b take :: Int -> Tree a -> Tree a drop :: Int -> Tree a -> Tree a insertAt :: MonadRandom m => Int -> a -> Tree a -> m (Tree a) deleteAt :: Int -> Tree a -> Tree a splitAt :: Int -> Tree a -> (Tree a, Tree a) elemIndexL :: Eq a => a -> Tree a -> Maybe Int elemIndicesL :: Eq a => a -> Tree a -> [Int] elemIndexR :: Eq a => a -> Tree a -> Maybe Int elemIndicesR :: Eq a => a -> Tree a -> [Int] findIndexL :: (a -> Bool) -> Tree a -> Maybe Int findIndicesL :: (a -> Bool) -> Tree a -> [Int] findIndicesL' :: Int -> (a -> Bool) -> Tree a -> [Int] -> [Int] findIndexR :: (a -> Bool) -> Tree a -> Maybe Int findIndicesR :: (a -> Bool) -> Tree a -> [Int] findIndicesR' :: Int -> (a -> Bool) -> Tree a -> [Int] -> [Int] mapWithIndex :: (Int -> a -> b) -> Tree a -> Tree b mapWithIndex' :: (Int -> a -> b) -> Int -> Tree a -> Tree b traverseWithIndex :: Applicative f => (Int -> a -> f b) -> Tree a -> f (Tree b) traverseWithIndex' :: Applicative f => (Int -> a -> f b) -> Int -> Tree a -> f (Tree b) zip :: Tree a -> Tree b -> Tree (a, b) zipWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c zipWith' :: (a -> b -> c) -> TList a -> TList b -> TList c -> TList c -- | A hacky implementation of the Applicative product. ap :: Tree (a -> b) -> Tree a -> Tree b module Data.Raz.Sequence.Internal data Seq' g a Seq' :: !g -> !(Tree a) -> Seq' g a -- |
--   pure :: a -> Impure (Seq a)
--   (<*>) :: Seq (a -> b) -> Seq a -> Seq b
--   
-- | The sequence type with a default generator. type Seq = Seq' StdGen -- | A type synonym for documentation. Marks uses of -- unsafePerformIO. type Impure a = a -- | A type synonym for documentation. Marks functions that only use the -- split method of random generators. type Splittable g = RandomGen g -- |
--   empty :: Impure (Seq a)
--   
-- -- O(1). The empty sequence. empty :: Seq a -- |
--   singleton :: a -> Impure (Seq a)
--   
-- -- O(1). A singleton sequence. singleton :: a -> Seq a -- |
--   fromList :: [a] -> Impure (Seq a)
--   
-- -- O(n). Create a sequence from a finite list of elements. -- -- The inverse toList is given by the Foldable instance of -- Seq. fromList :: [a] -> Seq a -- |
--   fromFunction :: Int -> (Int -> a) -> Impure (Seq a)
--   fromFunction n f = fromList (fmap f [0 .. n - 1])
--   
-- -- O(n). fromFunction :: Int -> (Int -> a) -> Seq a -- |
--   (<|) :: a -> Seq a -> Seq a
--   
(<|) :: RandomGen g => a -> Seq' g a -> Seq' g a -- |
--   (|>) :: Seq a -> a -> Seq a
--   
(|>) :: RandomGen g => Seq' g a -> a -> Seq' g a -- |
--   (><) :: Seq a -> Seq a -> Seq a
--   
(><) :: RandomGen g => Seq' g a -> Seq' g a -> Seq' g a -- | O(1). The empty sequence. empty' :: g -> Seq' g a -- | O(1). A singleton sequence. singleton' :: g -> a -> Seq' g a fromList' :: RandomGen g => g -> [a] -> Seq' g a -- |
--   replicate :: Int -> a -> Impure (Seq a)
--   
-- -- O(n). replicate :: Int -> a -> Seq a -- |
--   replicateA :: Applicative f => Int -> f a -> f (Impure (Seq a))
--   
-- -- O(n). replicateA :: Applicative f => Int -> f a -> f (Seq a) -- |
--   replicateM :: Monad m => Int -> m a -> m (Impure (Seq a))
--   
-- -- O(n). replicateM :: Monad m => Int -> m a -> m (Seq a) -- |
--   cycleTaking :: Int -> Seq a -> Seq a
--   
-- -- O(k). cycleTaking :: RandomGen g => Int -> Seq' g a -> Seq' g a -- |
--   iterateN :: Int -> (a -> a) -> a -> Impure (Seq a)
--   
-- -- O(n). iterateN :: Int -> (a -> a) -> a -> Seq a -- |
--   unfoldr :: (b -> Maybe (a, b)) -> b -> Impure (Seq a)
--   
-- -- O(n), where n is the length of the output sequence. unfoldr :: (b -> Maybe (a, b)) -> b -> Seq a -- |
--   unfoldl :: (b -> Maybe (b, a)) -> b -> Impure (Seq a)
--   
-- -- O(n), where n is the length of the output sequence. unfoldl :: (b -> Maybe (b, a)) -> b -> Seq a -- |
--   null :: Seq a -> Bool
--   
-- -- O(1). Is this the empty sequence? null :: Seq' g a -> Bool -- |
--   length :: Seq a -> Int
--   
-- -- O(1). The number of elements in the sequence. length :: Seq' g a -> Int data ViewL' g a EmptyL :: ViewL' g a (:<) :: a -> Seq' g a -> ViewL' g a viewl :: Seq' g a -> ViewL' g a -- |
--   tails :: Splittable g => Seq' g a -> Seq' g (Seq' g a)
--   tails :: Seq a -> Seq (Seq a)
--   
tails :: RandomGen g => Seq' g a -> Seq' g (Seq' g a) -- |
--   takeWhileL :: (a -> Bool) -> Seq a -> Seq a
--   
takeWhileL :: (a -> Bool) -> Seq' g a -> Seq' g a -- |
--   takeWhileR :: (a -> Bool) -> Seq a -> Seq a
--   
takeWhileR :: (a -> Bool) -> Seq' g a -> Seq' g a -- |
--   dropWhileL :: (a -> Bool) -> Seq a -> Seq a
--   
dropWhileL :: (a -> Bool) -> Seq' g a -> Seq' g a -- |
--   dropWhileR :: (a -> Bool) -> Seq a -> Seq a
--   
dropWhileR :: (a -> Bool) -> Seq' g a -> Seq' g a -- |
--   spanl :: Splittable g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a)
--   spanl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
--   
spanl :: RandomGen g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   spanr :: Splittable g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a)
--   spanr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
--   
spanr :: RandomGen g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   breakl :: Splittable g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a)
--   breakl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
--   
breakl :: RandomGen g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   breakr :: Splittable g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a)
--   breakr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
--   
breakr :: RandomGen g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   partition :: Splittable g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a)
--   partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
--   
partition :: RandomGen g => (a -> Bool) -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   filter :: (a -> Bool) -> Seq a -> Seq a
--   
filter :: (a -> Bool) -> Seq' g a -> Seq' g a -- |
--   lookup :: Int -> Seq a -> Maybe a
--   
lookup :: Int -> Seq' g a -> Maybe a -- |
--   (?!) :: Seq a -> Int -> Maybe a
--   
(?!) :: Seq' g a -> Int -> Maybe a -- |
--   index :: Seq a -> Int -> a
--   
index :: Seq' g a -> Int -> a -- |
--   adjust :: (a -> a) -> Int -> Seq a -> Seq a
--   
adjust :: (a -> a) -> Int -> Seq' g a -> Seq' g a -- |
--   adjust' :: (a -> a) -> Int -> Seq a -> Seq a
--   
adjust' :: (a -> a) -> Int -> Seq' g a -> Seq' g a -- |
--   update :: Int -> a -> Seq a -> Seq a
--   
update :: Int -> a -> Seq' g a -> Seq' g a -- |
--   take :: Int -> Seq a -> Seq a
--   
take :: Int -> Seq' g a -> Seq' g a -- |
--   drop :: Int -> Seq a -> Seq a
--   
drop :: Int -> Seq' g a -> Seq' g a -- |
--   insertAt :: Int -> a -> Seq a -> Seq a
--   
insertAt :: RandomGen g => Int -> a -> Seq' g a -> Seq' g a -- |
--   deleteAt :: Int -> Seq a -> Seq a
--   
deleteAt :: Int -> Seq' g a -> Seq' g a -- |
--   splitAt :: Splittable g => Int -> Seq' g a -> (Seq' g a, Seq' g a)
--   splitAt :: Int -> Seq a -> (Seq a, Seq a)
--   
splitAt :: RandomGen g => Int -> Seq' g a -> (Seq' g a, Seq' g a) -- |
--   mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b
--   
mapWithIndex :: (Int -> a -> b) -> Seq' g a -> Seq' g b -- |
--   traverseWithIndex :: Applicative f => (Int -> a -> f b) -> Seq a -> Seq b
--   
traverseWithIndex :: Applicative f => (Int -> a -> f b) -> Seq' g a -> f (Seq' g b) -- |
--   zip :: Seq a -> Seq b -> Seq (a, b)
--   
zip :: Seq' g a -> Seq' g b -> Seq' g (a, b) -- |
--   zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c
--   
zipWith :: (a -> b -> c) -> Seq' g a -> Seq' g b -> Seq' g c splitSeq :: Splittable g => Seq' g a -> (Seq' g a, Seq' g a) -- | Put a fresh generator. refreshSeq :: Seq' g a -> Impure (Seq a) -- | Wrap a Tree into a Seq. createSeq :: Tree a -> Impure (Seq a) seqBind :: Seq' g a -> (Tree a -> Rand g (Tree b)) -> Seq' g b seqDnib :: (Tree a -> Rand g (Tree b)) -> Seq' g a -> Seq' g b seqRun :: g -> Rand g (Tree a) -> Seq' g a seqLift :: (Tree a -> Tree b) -> Seq' g a -> Seq' g b seqLift2 :: (Tree a -> Tree b -> Tree c) -> Seq' g a -> Seq' g b -> Seq' g c seqLiftSplit :: Splittable g => (Tree a -> (Tree b, Tree c)) -> Seq' g a -> (Seq' g b, Seq' g c) seqApply :: (Tree a -> b) -> Seq' g a -> b seqLens :: Functor f => (Tree a -> f (Tree b)) -> Seq' g a -> f (Seq' g b) instance Data.Traversable.Traversable (Data.Raz.Sequence.Internal.Seq' g) instance Data.Foldable.Foldable (Data.Raz.Sequence.Internal.Seq' g) instance GHC.Base.Functor (Data.Raz.Sequence.Internal.Seq' g) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Raz.Sequence.Internal.Seq' g a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Raz.Sequence.Internal.Seq' g a) instance GHC.Show.Show a => GHC.Show.Show (Data.Raz.Sequence.Internal.Seq' g a) instance GHC.Base.Applicative (Data.Raz.Sequence.Internal.Seq' System.Random.StdGen) -- | A Data.Sequence replacement. module Data.Raz.Sequence -- | A Haskell translation of the original OCaml implementation. module Data.Raz.Core