[commit: ghc] wip/nfs-locking: Makes wordsWhen more generic. (5ccd03c)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:00:12 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/5ccd03cac69896ef8ff2df7a8601aa1baa110c98/ghc

>---------------------------------------------------------------

commit 5ccd03cac69896ef8ff2df7a8601aa1baa110c98
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Thu Jan 7 20:38:11 2016 +0800

    Makes wordsWhen more generic.


>---------------------------------------------------------------

5ccd03cac69896ef8ff2df7a8601aa1baa110c98
 src/Base.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Base.hs b/src/Base.hs
index 8830a7c..86ddbf5 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -241,9 +241,9 @@ removeDirectoryIfExists d =
 
 -- | Split function. Splits a string @s@ into chunks
 -- when the predicate @p@ holds. See: http://stackoverflow.com/a/4981265
-wordsWhen :: (Char -> Bool) -> String -> [String]
+wordsWhen :: Eq a => (a -> Bool) -> [a] -> [[a]]
 wordsWhen p s =
     case dropWhile p s of
-        "" -> []
+        [] -> []
         s' -> w : wordsWhen p s''
             where (w, s'') = break p s'



More information about the ghc-commits mailing list