-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Join list - symmetric list type
--
-- A JoinList - a list type with with cheap catenation.
--
-- The earliest attribution have found is to Richard Bird. An
-- implementation exists in york-lava.
--
-- Cameo appearances:
--
--
-- - GHC Team 'View patterns: lightweight views for Haskell'
-- - Mark Tullsen 'First Class Patterns'
-- - Meng Wang, Jeremy Gibbons, Kazutaka Matsuda, Zhenjiang Hu
-- 'Translucent Abstraction: Safe Views through Invertible
-- Programming'
--
@package joinlist
@version 0.1.0
-- | A Join List datatype and operations.
--
-- Join Lists are symmetric lists where joining two lists (catenation,
-- aka (++)) is a cheap operation. This constrasts with the regular list
-- datatype which is a cons list: while consing on a regular list
-- (building a list by adding an elementary prefix) is by nature cheap,
-- joining (++) is expensive.
module Data.JoinList
data JoinList a
-- | Create an empty join list.
empty :: JoinList a
-- | Create a singleton join list.
wrap :: a -> JoinList a
-- | Catenate two join lists. Unlike (++) on regular lists, catenation on
-- join lists is (relatively) cheap hence the monicker join list.
(++) :: JoinList a -> JoinList a -> JoinList a
-- | An alias for (++) that does not cause a name clash with the Prelude.
join :: JoinList a -> JoinList a -> JoinList a
-- | Test whether a join list is empty.
null :: JoinList a -> Bool
-- | Concatenate a (join) list of (join) lists.
concat :: JoinList (JoinList a) -> JoinList a
-- | Get the length of a join list.
length :: JoinList a -> Int
-- | Map a function over a join list.
map :: (a -> b) -> JoinList a -> JoinList b
-- | Build a join list of n elements.
replicate :: Int -> a -> JoinList a
-- | Repeatedly build a join list by catenating the seed list.
repeated :: Int -> JoinList a -> JoinList a
-- | A Jeremy Gibbons style generalised fold, where each constructor has an
-- operation.
gfold :: b -> (a -> b) -> (b -> b -> b) -> JoinList a -> b
-- | cross zip - zip a join list against a regular list, maintaining
-- the shape of the join list provided the lengths of the lists match.
xzip :: JoinList a -> [b] -> JoinList (a, b)
-- | Generalized cross zip - c.f. zipWith on regular lists.
xzipWith :: (a -> b -> c) -> JoinList a -> [b] -> JoinList c
-- | Convert a join list to a regular list.
toList :: JoinList a -> [a]
-- | Build a join list from a regular list.
fromList :: [a] -> JoinList a
instance (Eq a) => Eq (JoinList a)
instance Traversable JoinList
instance Foldable JoinList
instance Monad JoinList
instance Functor JoinList
instance Monoid (JoinList a)
instance (Show a) => Show (JoinList a)