cookbook-3.0.1.1: Tiered general-purpose libraries with domain-specific applications.

Copyright(c) 2014 by Nate Pisarski
LicenseBSD3
Maintainernathanpisarski@gmail.com
StabilityStable
PortabilityPortable (Standalone - ghc)
Safe HaskellSafe
LanguageHaskell98

Cookbook.Ingredients.Functional.Break

Description

Library for breaking conditionally on lists. When one filters a list, it will filter all of the elements. When one filterBREAKS a list, it will stop collecting the list at a desired element. This library also includes functions for conditionally transforming a list.

Synopsis

Documentation

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

Drop a list until a predicate yields false, returning the false item and the rest of the list.

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

Collect a list until a predicate yields false for a value.

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

Returns true if any element in the list yields true for a predicate.

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

Conditionally transform a list. If a predicate returns true, use lval. Otherwise, use rval.