Haskell takeWhile function
= Haskell takeWhile function
{c}
= TakeWhile function
{synonym}
The <higher-order function> `takeWhile :: (a -> Bool) -> [a] -> [a]` retains the longest initial segment whose elements all satisfy its predicate. It stops at the first failure and does not resume later. Thus it differs from a <list filter>, which tests later elements as well.