Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Util.Then

Description

List functions with continuations. This allows you to chain them and easily express things like 'take until f then take one more'.

Synopsis
  • takeWhile :: (a -> Bool) -> ([a] -> [a]) -> [a] -> [a]
  • takeWhile1 :: (a -> Bool) -> [a] -> [a]
  • take :: Int -> ([a] -> [a]) -> [a] -> [a]
  • filter :: (a -> Bool) -> (a -> Bool) -> ([a] -> [a]) -> [a] -> [a]
  • map :: (a -> b) -> [b] -> [a] -> [b]
  • mapAccumL :: (acc -> x -> (acc, y)) -> acc -> (acc -> [y]) -> [x] -> [y]
  • mapM :: Monad m => (a -> m b) -> m [b] -> [a] -> m [b]
  • break :: (a -> Bool) -> ([a] -> ([a], rest)) -> [a] -> ([a], rest)
  • span :: (a -> Bool) -> ([a] -> ([a], rest)) -> [a] -> ([a], rest)
  • break1 :: (a -> Bool) -> [a] -> ([a], [a])

Documentation

takeWhile :: (a -> Bool) -> ([a] -> [a]) -> [a] -> [a] Source #

takeWhile1 :: (a -> Bool) -> [a] -> [a] Source #

takeWhile plus one extra

take :: Int -> ([a] -> [a]) -> [a] -> [a] Source #

filter :: (a -> Bool) -> (a -> Bool) -> ([a] -> [a]) -> [a] -> [a] Source #

map :: (a -> b) -> [b] -> [a] -> [b] Source #

mapAccumL :: (acc -> x -> (acc, y)) -> acc -> (acc -> [y]) -> [x] -> [y] Source #

Like List.mapAccumL, except that you can do something with the final state and append that to the list.

mapM :: Monad m => (a -> m b) -> m [b] -> [a] -> m [b] Source #

break Source #

Arguments

:: (a -> Bool) 
-> ([a] -> ([a], rest))

Given the list after the break, return (pre, post), where pre will be appended to the end of the first list.

-> [a] 
-> ([a], rest) 

span :: (a -> Bool) -> ([a] -> ([a], rest)) -> [a] -> ([a], rest) Source #

break1 :: (a -> Bool) -> [a] -> ([a], [a]) Source #

Break right after the function returns True.