
23 Jul
2009
23 Jul
'09
1:46 a.m.
On Thu, Jul 23, 2009 at 07:28:55AM +0200, Matthias Görgens wrote: ] I often want to take one more element than takeWhile does, or only
takeWhileMore n p x | p x = Just . F $ takeWhileMore n p | otherwise = Just . F $ takeN n
] start checking the predicate after taking the first element for sure.
plusFirst = const . Just . F
] Or both.
both = plusFirst . takeWhileMore 1
:) -- Felipe.