Copyright | (c) 2015-2017 Rudy Matela |
---|---|

License | 3-Clause BSD (see the file LICENSE) |

Maintainer | Rudy Matela <rudy@matela.com.br> |

Safe Haskell | None |

Language | Haskell2010 |

General purpose utility functions for FitSpec

## Synopsis

- (...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
- uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
- count :: (a -> Bool) -> [a] -> Int
- compositions :: [Bool] -> [Bool]
- subsets :: [a] -> [[a]]
- contained :: Eq a => [a] -> [a] -> Bool
- contains :: Eq a => [a] -> [a] -> Bool
- filterU :: (a -> a -> Bool) -> [a] -> [a]
- sortAndGroupOn :: Ord b => (a -> b) -> [a] -> [[a]]
- sortAndGroupFstBySnd :: Ord b => [(a, b)] -> [([a], b)]
- sortGroupAndCollapse :: Ord b => (a -> b) -> (a -> c) -> (b -> [c] -> d) -> [a] -> [d]
- takeWhileIncreasing :: (a -> a -> Ordering) -> [a] -> [a]
- takeWhileIncreasingOn :: Ord b => (a -> b) -> [a] -> [a]
- lastTimeout :: Int -> [a] -> IO a
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- (***) :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)

# Documentation

(...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d Source #

Compose composed with compose operator.

(f ... g) x y === f (g x y)

compositions :: [Bool] -> [Bool] Source #

`compositions`

`bs`

returns all compositions formed by taking values of `bs`

subsets :: [a] -> [[a]] Source #

`subsets`

`xs`

returns the list of sublists formed by taking values of `xs`

contained :: Eq a => [a] -> [a] -> Bool Source #

Check if all elements of a list is contained in another list

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

`filterU`

filter greater-later elements in a list according to a partial
ordering relation.

filterU (notContained) [[1],[2],[1,2,3],[3,4,5]] == [[1],[2],[3,4,5]]

sortAndGroupOn :: Ord b => (a -> b) -> [a] -> [[a]] Source #

sortAndGroupFstBySnd :: Ord b => [(a, b)] -> [([a], b)] Source #

sortGroupAndCollapse :: Ord b => (a -> b) -> (a -> c) -> (b -> [c] -> d) -> [a] -> [d] Source #

takeWhileIncreasing :: (a -> a -> Ordering) -> [a] -> [a] Source #

Takes values from a list while the values increase. If the original list is non-empty, the returning list will also be non-empty

takeWhileIncreasingOn :: Ord b => (a -> b) -> [a] -> [a] Source #

lastTimeout :: Int -> [a] -> IO a Source #

`lastTimeout s xs`

will take the last value of `xs`

it is able evaluate
before `s`

seconds elapse.