-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A data type with elements separated by values -- @package separated @version 0.1.0 module Data.Separated.SeparatedCons -- | Prepend a value to a separated-like structure. class (f ~ SeparatedConsF g, g ~ SeparatedConsG f) => SeparatedCons f g where type family SeparatedConsF g :: * -> * -> * type family SeparatedConsG f :: * -> * -> * (+:) :: SeparatedCons f g => a -> f s a -> g a s module Data.Separated.Separated data Separated s a -- | The isomorphism to a list of pairs of element and separator values. -- --
--   >>> separated # empty
--   []
--   
-- --
--   >>> separated # ('x' +: 6 +: empty)
--   [('x',6)]
--   
-- --
--   >>> [] ^. separated
--   []
--   
-- --
--   >>> [(6, [])] ^. separated
--   [6,[]]
--   
separated :: Iso [(s, a)] [(t, b)] (Separated s a) (Separated t b) data Separated1 a s -- | The isomorphism to element values interspersed with a separator. -- --
--   >>> separated1 # (single 6)
--   (6,[])
--   
-- --
--   >>> separated1 # (5 +: 'x' +: single 6)
--   (5,['x',6])
--   
-- --
--   >>> (6, empty) ^. separated1
--   [6]
--   
-- --
--   >>> (5, 'x' +- 6) ^. separated1
--   [5,'x',6]
--   
separated1 :: Iso (a, Separated s a) (b, Separated t b) (Separated1 a s) (Separated1 b t) -- | A lens on the first element value. -- --
--   >>> single 7 ^. separated1Head
--   7
--   
-- --
--   single x ^. separated1Head == (x :: Int)
--   
separated1Head :: Lens (Separated1 a t) (Separated1 a t) a a -- | A lens on the tail. -- --
--   (d +: e +: single x) ^. separated1Tail == e +: x +: empty
--   
separated1Tail :: Lens (Separated1 a s) (Separated1 a t) (Separated s a) (Separated t a) empty :: Separated s a -- | One element and one separator. -- --
--   >>> 7 +- "abc"
--   [7,"abc"]
--   
-- --
--   >>> 7 +: "abc" +: 8 +- "def"
--   [7,"abc",8,"def"]
--   
(+-) :: s -> a -> Separated s a -- | Zero element values interspersed with one element. -- --
--   >>> single 4
--   [4]
--   
-- --
--   single x ^. separated1Tail == empty
--   
single :: a -> Separated1 a s -- | The isomorphism that shuffles the elements and separators one -- position. -- --
--   >>> shift # ([], 6)
--   [6]
--   
-- --
--   >>> shift # ([(5, 'x')], 6)
--   [5,'x',6]
--   
-- --
--   >>> single 6 ^. shift
--   ([],6)
--   
-- --
--   >>> (5 +: 'x' +: single 6) ^. shift
--   ([(5,'x')],6)
--   
shift :: Iso (Separated1 a s) (Separated1 b t) ([(a, s)], a) ([(b, t)], b) -- | The isomorphism that swaps elements with their separators. -- --
--   >>> separatedSwap # empty
--   []
--   
-- --
--   >>> separatedSwap # ('x' +: 6 +: empty)
--   [6,'x']
--   
-- --
--   >>> empty ^. separatedSwap
--   []
--   
-- --
--   >>> ('x' +: 6 +: empty) ^. separatedSwap
--   [6,'x']
--   
separatedSwap :: Iso (Separated s a) (Separated t b) (Separated a s) (Separated b t) -- | Append two lists of separated values to produce a list of pairs of -- separator and element values. -- --
--   >>> single 7 .++. single 'a'
--   [7,'a']
--   
-- -- a +: single 7 .++. single b -- [a,7,b] -- --
--   a +: (b .++. c) == (a +: b) *+: c
--   
(.++.) :: Separated1 s a -> Separated1 a s -> Separated s a -- | Append element values interspersed with a separator to a list of pairs -- of separator and element values. -- --
--   >>> empty ++. single 7
--   [7]
--   
-- --
--   >>> empty ++. 6 +: 'x' +: single 7
--   [6,'x',7]
--   
-- --
--   >>> 'w' +: empty ++. 6 +: 'x' +: single 7
--   ['w',6,'x',7]
--   
(++.) :: Separated s a -> Separated1 s a -> Separated1 s a -- | Append a list of pairs of separator and element values to element -- values interspersed with a separator. -- --
--   >>> single 7 .++ empty
--   [7]
--   
-- --
--   >>> single 6 .++ 'x' +: 7 +: empty
--   [6,'x',7]
--   
-- --
--   >>> 'w' +: single 6 .++ 'x' +: 7 +: empty
--   ['w',6,'x',7]
--   
(.++) :: Separated1 a s -> Separated s a -> Separated1 a s instance (Eq s, Eq a) => Eq (Separated s a) instance (Ord s, Ord a) => Ord (Separated s a) instance (Eq a, Eq s) => Eq (Separated1 a s) instance (Ord a, Ord s) => Ord (Separated1 a s) instance SeparatedCons Separated Separated1 instance Monoid s => Applicative (Separated1 s) instance (Show a, Show s) => Show (Separated1 a s) instance Semigroup s => Apply (Separated1 s) instance Functor (Separated1 s) instance Bifunctor Separated1 instance SeparatedCons Separated1 Separated instance Monoid (Separated s a) instance Semigroup (Separated s a) instance (Show s, Show a) => Show (Separated s a) instance Monoid s => Applicative (Separated s) instance Semigroup s => Apply (Separated s) instance Functor (Separated s) instance Bifunctor Separated module Data.Separated.FlipSeparatedCons -- | Prepend a value to a separated-like structure. class (f ~ FlipSeparatedConsF g, g ~ FlipSeparatedConsG f) => FlipSeparatedCons f g where type family FlipSeparatedConsF g :: * -> * -> * type family FlipSeparatedConsG f :: * -> * -> * (+.) :: FlipSeparatedCons f g => s -> f s a -> g a s module Data.Separated.FlipSeparated data FlipSeparated a s -- | The isomorphism to a Separator. -- --
--   >>> empty ^. flipSeparated
--   []
--   
-- --
--   >>> ('x' +: 6 +: empty) ^. flipSeparated
--   ['x',6]
--   
-- --
--   >>> [] ^. separated . flipSeparated
--   []
--   
-- --
--   >>> [(6, [])] ^. separated . flipSeparated
--   [6,[]]
--   
flipSeparated :: Iso (Separated s a) (Separated t b) (FlipSeparated a s) (FlipSeparated b t) -- | The isomorphism to a Separated1. -- --
--   >>> single 6 ^. flipSeparated1
--   [6]
--   
-- --
--   >>> (5 +: 'x' +: single 6) ^. flipSeparated1
--   [5,'x',6]
--   
-- --
--   >>> (6 +: empty) ^. flipSeparated1
--   [6]
--   
-- --
--   >>> (5 +: 'x' +: 6 +: empty) ^. flipSeparated1
--   [5,'x',6]
--   
flipSeparated1 :: Iso (Separated1 a s) (Separated1 b t) (FlipSeparated1 s a) (FlipSeparated1 t b) fempty :: FlipSeparated a s instance (Eq a, Eq s) => Eq (FlipSeparated a s) instance (Ord a, Ord s) => Ord (FlipSeparated a s) instance FlipSeparatedCons FlipSeparated FlipSeparated1 instance (Show s, Show a) => Show (FlipSeparated1 s a) instance Monoid s => Applicative (FlipSeparated1 s) instance Semigroup a => Apply (FlipSeparated1 a) instance Functor (FlipSeparated1 a) instance Bifunctor FlipSeparated1 instance FlipSeparatedCons FlipSeparated1 FlipSeparated instance Monoid (FlipSeparated s a) instance Semigroup (FlipSeparated s a) instance (Show s, Show a) => Show (FlipSeparated s a) instance Monoid s => Applicative (FlipSeparated s) instance Semigroup a => Apply (FlipSeparated a) instance Functor (FlipSeparated a) instance Bifunctor FlipSeparated module Data.Separated