Hello,

I need a break function that splits the list one element further than
the ordinary break.
This is the simplest solution I could imagine:

breakI :: (a -> Bool) -> [a] -> ([a], [a])
breakI p s = case break p s of
               ([], []) -> ([], [])
               (x, []) -> (x, [])
               (x,  l)  ->  (x ++ [head l], tail l )

Is there a better way to write this ?

thanks in advance,

Pieter

-- 
Pieter Laeremans <[EMAIL PROTECTED]>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to