diff options
author | 2012-12-13 00:29:06 -0400 | |
---|---|---|
committer | 2012-12-13 00:29:06 -0400 | |
commit | de6406afce6de0cf8a48bc2ecf9be1e7de93e40e (patch) | |
tree | 08705fab60c11d4073734a8c2500a88b1aab7852 /Utility/Misc.hs | |
parent | 3e55a8f164d67d5bd1ef86ae2f38fb2c6c3a51b2 (diff) | |
parent | 94554782894ec6c26da3b46312d5d1d16d596458 (diff) |
Merge branch 'master' into desymlink
Conflicts:
Annex/CatFile.hs
Annex/Content.hs
Git/LsFiles.hs
Git/LsTree.hs
Diffstat (limited to 'Utility/Misc.hs')
-rw-r--r-- | Utility/Misc.hs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Utility/Misc.hs b/Utility/Misc.hs index 7c81f56fd..c04409563 100644 --- a/Utility/Misc.hs +++ b/Utility/Misc.hs @@ -33,10 +33,10 @@ readFileStrict = readFile >=> \s -> length s `seq` return s -} separate :: (a -> Bool) -> [a] -> ([a], [a]) separate c l = unbreak $ break c l - where - unbreak r@(a, b) - | null b = r - | otherwise = (a, tail b) + where + unbreak r@(a, b) + | null b = r + | otherwise = (a, tail b) {- Breaks out the first line. -} firstLine :: String -> String @@ -47,11 +47,11 @@ firstLine = takeWhile (/= '\n') - Segments may be empty. -} segment :: (a -> Bool) -> [a] -> [[a]] segment p l = map reverse $ go [] [] l - where - go c r [] = reverse $ c:r - go c r (i:is) - | p i = go [] (c:r) is - | otherwise = go (i:c) r is + where + go c r [] = reverse $ c:r + go c r (i:is) + | p i = go [] (c:r) is + | otherwise = go (i:c) r is prop_segment_regressionTest :: Bool prop_segment_regressionTest = all id @@ -64,11 +64,11 @@ prop_segment_regressionTest = all id {- Includes the delimiters as segments of their own. -} segmentDelim :: (a -> Bool) -> [a] -> [[a]] segmentDelim p l = map reverse $ go [] [] l - where - go c r [] = reverse $ c:r - go c r (i:is) - | p i = go [] ([i]:c:r) is - | otherwise = go (i:c) r is + where + go c r [] = reverse $ c:r + go c r (i:is) + | p i = go [] ([i]:c:r) is + | otherwise = go (i:c) r is {- Given two orderings, returns the second if the first is EQ and returns - the first otherwise. @@ -96,9 +96,9 @@ hGetSomeString h sz = do fp <- mallocForeignPtrBytes sz len <- withForeignPtr fp $ \buf -> hGetBufSome h buf sz map (chr . fromIntegral) <$> withForeignPtr fp (peekbytes len) - where - peekbytes :: Int -> Ptr Word8 -> IO [Word8] - peekbytes len buf = mapM (peekElemOff buf) [0..pred len] + where + peekbytes :: Int -> Ptr Word8 -> IO [Word8] + peekbytes len buf = mapM (peekElemOff buf) [0..pred len] {- Reaps any zombie git processes. - |