úÎ>A:ß4      !"#$%&'()*+,-./0123 foldr for ListT 45    A class for list types. % Every list has an underlying monad. :Transform an action returning a list to the returned list  > joinL $ Identity "hello"  "hello"  foldr for  s.  the result and ' right side' values are monadic actions.  Convert to a . ECan be done with a foldrL but included in type-class for efficiency. Convert from a . ECan be done with a foldrL but included in type-class for efficiency. Prepend an item to a 6 Convert a list to a 6  > fromList [] :: Maybe Int  Nothing  > fromList [5] :: Maybe Int  Just 5 5Convert between lists with the same underlying monad filter for any MonadPlus  > filter (> 5) (Just 3)  Nothing 7An action to do foldl for  s !Execute the monadic actions in a   7Transform a list of actions to a list of their results " > joinM [Identity 4, Identity 7]  [4,7] An action to transform a   to a list ! > runIdentity $ toList "hello!"  "hello!" ;Consume a list (execute its actions) and return its length ! > runIdentity $ lengthL [1,2,3]  3 LTransform the underlying monad of a list given a way to transform the monad  > import Data.List.Tree (bfs) M > bfs (transformListMonad (\(Identity x) -> [x, x]) "hey" :: ListT [] Char)  "hheeeeyyyyyyyy" ALift the underlying monad of a list and transform it to a ListT.  Doing plain 'transformListMonad lift' instead doesn't give the compiler % the same knowledge about the types. *Consume all items and return the last one  > runIdentity $ lastL "hello"  'o' !  !  !    !"A monadic difference-list #$"#$"#$"#$#$%A monad transformer to create Lists.  & transforms a GeneratorT v m a to a  DListT m a. 89&O(1), Transform a GeneratorT to a " 'O(1), Output a result value (O(1), Output all the values of a ". %&'(%&'(%&'()!A monad tranformer for consuming  s. :;* Consume a  <+Consume/get the next value ,CReturn an instance of the underlying monad that will use the given )" to consume the remaining values. _ After this action there are no more items to consume (they belong to the given ConsumerT now) )*+,)*+,)*+, -A 'type-class synonym' for Trees. =.6Iterate a tree in DFS pre-order. (Depth First Search) >/ATransform a tree into lists of the items in its different layers 04Iterate a tree in BFS order. (Breadth First Search) ?1,Best First Search given a scoring function. @2#Best-First-Search given that a node'Js children are in sorted order (best first) and given a scoring function. T Especially useful for trees where nodes have an infinite amount of children, where 1 will get stuck. ,Example: Find smallest Pythagorian Triplets  import Control.Monad  import Control.Monad.Generator  import Control.Monad.Trans  import Data.List.Tree  import Data.Maybe   pythagorianTriplets =  catMaybes .  fmap fst . ) bestFirstSearchSortedChildrenOn snd .  generate $ do  x <- lift [1..]  yield (Nothing, x)  y <- lift [1..]  yield (Nothing, x + y)  z <- lift [1..]  yield (Nothing, x + y + z) % lift . guard $ x^2 + y^2 == z^2  yield (Just (x, y, z), 0)  ' > print $ take 10 pythagorianTriplets a [(3,4,5),(4,3,5),(6,8,10),(8,6,10),(5,12,13),(12,5,13),(9,12,15),(12,9,15),(15,8,17),(8,15,17)] 3(Prune a tree or list given a predicate.  Unlike A/ which stops a branch where the condition doesn't hold,  prune cuts+ the whole branch (the underlying MonadPlus' s mzero). -./0123-.0/132-./0123B      !"#$%&'(()*+,-./0123456789:;<=*>.?@ABCD:EFgenerator-0.5.1Control.Monad.ListTData.List.ClassControl.Monad.DListControl.Monad.GeneratorControl.Monad.ConsumerData.List.TreeListTrunListTListItemConsheadLtailLNil foldrListTListItemMjoinLfoldrLtoListT fromListTconsfromListconvListfilterfoldlLscanl genericTakeexecutejoinM takeWhiletoListlengthLtransformListMonad liftListMonadzipzipWithlastLrepeat transposeDListT runDListT GeneratorTgenerateyieldyields ConsumerT evalConsumerTnext consumeRestMTreedfs bfsLayersbfsbestFirstSearchOnbestFirstSearchSortedChildrenOnprune foldrListT'base Control.Monad MonadPlusfoldlL' runGeneratorT runConsumerT putNoProducersearch toListTreemergeOnmergeOnSortedHeadsGHC.List