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.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to