Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Zipper (t :: Type -> Type) a
- zipper :: Traversable t => t a -> Maybe (Zipper t a)
- zipper1 :: Traversable1 t => t a -> Zipper t a
- unzipper :: Zipper t a -> t a
- size :: Zipper t a -> Int
- paginate :: Int -> [a] -> Maybe (Zipper [] [a])
- paginate' :: MonadThrow m => Int -> [a] -> m (Zipper [] [a])
- data PaginationException
- zipperNextMaybe :: Zipper t a -> Maybe a
- zipperPreviousMaybe :: Zipper t a -> Maybe a
- zipperWithin :: Int -> Zipper t a -> [a]
Documentation
data Zipper (t :: Type -> Type) a #
Instances
ComonadStore Int (Zipper t) | |
Functor (Zipper t) | |
Foldable (Zipper t) | |
Defined in Control.Comonad.Store.Zipper fold :: Monoid m => Zipper t m -> m # foldMap :: Monoid m => (a -> m) -> Zipper t a -> m # foldr :: (a -> b -> b) -> b -> Zipper t a -> b # foldr' :: (a -> b -> b) -> b -> Zipper t a -> b # foldl :: (b -> a -> b) -> b -> Zipper t a -> b # foldl' :: (b -> a -> b) -> b -> Zipper t a -> b # foldr1 :: (a -> a -> a) -> Zipper t a -> a # foldl1 :: (a -> a -> a) -> Zipper t a -> a # elem :: Eq a => a -> Zipper t a -> Bool # maximum :: Ord a => Zipper t a -> a # minimum :: Ord a => Zipper t a -> a # | |
Traversable (Zipper t) | |
Comonad (Zipper t) | |
Extend (Zipper t) | |
zipper :: Traversable t => t a -> Maybe (Zipper t a) #
zipper1 :: Traversable1 t => t a -> Zipper t a #
paginate :: Int -> [a] -> Maybe (Zipper [] [a]) Source #
Turn a list into a zipper of chunks of length n
paginate' :: MonadThrow m => Int -> [a] -> m (Zipper [] [a]) Source #
Like paginate
, but throw an exception if it can't create the zipper.
data PaginationException Source #
Instances
Eq PaginationException Source # | |
Defined in Control.Comonad.Zipper.Extra (==) :: PaginationException -> PaginationException -> Bool # (/=) :: PaginationException -> PaginationException -> Bool # | |
Show PaginationException Source # | |
Defined in Control.Comonad.Zipper.Extra showsPrec :: Int -> PaginationException -> ShowS # show :: PaginationException -> String # showList :: [PaginationException] -> ShowS # | |
Exception PaginationException Source # | |
zipperNextMaybe :: Zipper t a -> Maybe a Source #
Return the peek of the next element if it exists.
zipperPreviousMaybe :: Zipper t a -> Maybe a Source #
Return the peek of the previous element if it exists.
zipperWithin :: Int -> Zipper t a -> [a] Source #