-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | FoldMap lists -- -- FoldMap lists are lists represented by their foldMap function. FoldMap -- lists have O(1) cons, snoc and append, just like DLists, but other -- operations might have favorable performance characteristics as well. -- These wild claims are still completely unverified though. @package fmlist @version 0.6 -- | FoldMap lists: lists represented by their foldMap function. -- -- Examples: -- --
-- -- A right-infinite list -- c = 1 `cons` c ---- --
-- -- A left-infinite list -- d = d `snoc` 2 ---- --
-- -- A middle-infinite list ?? -- e = c `append` d ---- --
-- *> head e -- 1 -- *> last e -- 2 --module Data.FMList -- | FMList is a foldMap function wrapped up in a newtype. newtype FMList a FM :: (forall m. (Monoid m) => (a -> m) -> m) -> FMList a unFM :: FMList a -> forall m. (Monoid m) => (a -> m) -> m -- | The function transform transforms a list by changing the map -- function that is passed to foldMap. -- -- It has the following property: -- --
-- transform a . transform b = transform (b . a) ---- -- For example: -- --
m >>= g
= flatten (fmap g m)
= flatten . fmap g $ m
= transform foldMap . transform (. g) $ m
= transform ((. g) . foldMap) m
= transform (\f -> foldMap f . g) m
-- *> unfold (\b -> if b == 0 then empty else Left (b-1) `pair` Right b) 10 -- fromList [1,2,3,4,5,6,7,8,9,10] --unfold :: (b -> FMList (Either b a)) -> b -> FMList a -- | unfoldr builds an FMList from a seed value from left to -- right. The function takes the element and returns Nothing if it -- is done producing the list or returns Just (a,b), in -- which case, a is a appended to the result and b is -- used as the next seed value in a recursive call. -- -- A simple use of unfoldr: -- --
-- *> unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10 -- fromList [10,9,8,7,6,5,4,3,2,1] --unfoldr :: (b -> Maybe (a, b)) -> b -> FMList a instance Traversable FMList instance (Applicative f, Monoid m) => Monoid (WrapApp f m) instance (Show a) => Show (FMList a) instance Alternative FMList instance MonadPlus FMList instance Monoid (FMList a) instance Applicative FMList instance Monad FMList instance Foldable FMList instance Functor FMList