So, these two functions do not appear to be defined, perhaps because
many of their potential uses could be expressed using the functions
from Data.Applicative and Data.Arrow instead.

You may have noticed that the words and lines examples where defunct,
but not difficult to fix:

words = go . dropWhile isSpace where
    go [] = []
    go s  = withPair (:) id words (break isSpace s)


lines [] = []
lines s  = withPair (:) id (lines . safeTail) (break (== '\n') s)

safeTail [] = []
safeTail l  = tail l


Ofcourse RHS of 'lines s' can be written (and likewise for words):

uncurry (:) $ second (lines . safeTail) $ break (== '\n') s

which looks rather nice to me.

/Johan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to