fork download
  1.  
  2. takeWhileInclusive :: (a -> Bool) -> [a] -> [a]
  3. takeWhileInclusive _ [] = []
  4. takeWhileInclusive p (x:xs) = x : if p x then takeWhileInclusive p xs
  5. else []
  6.  
  7. main = print $ takeWhileInclusive (>1) [2,2,2,2,2,1,1,1,1,1,1,1]
Success #stdin #stdout 0s 5556KB
stdin
Standard input is empty
stdout
[2,2,2,2,2,1]