projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a87eeb2
)
Add spec rules for sections in Data.ByteString
author
Don Stewart
<dons@cse.unsw.edu.au>
Thu, 24 Aug 2006 01:26:11 +0000
(
01:26
+0000)
committer
Don Stewart
<dons@cse.unsw.edu.au>
Thu, 24 Aug 2006 01:26:11 +0000
(
01:26
+0000)
Data/ByteString.hs
patch
|
blob
|
history
diff --git
a/Data/ByteString.hs
b/Data/ByteString.hs
index
6dbc3e6
..
df76e6b
100644
(file)
--- a/
Data/ByteString.hs
+++ b/
Data/ByteString.hs
@@
-1009,10
+1009,10
@@
break p ps = case findIndexOrEnd p ps of n -> (unsafeTake n ps, unsafeDrop n ps)
#-}
#if __GLASGOW_HASKELL__ >= 605
#-}
#if __GLASGOW_HASKELL__ >= 605
--- {-# RULES
--- "FPS specialise break (==x)" forall x.
--- break (==x) = breakByte x
--- #-}
+{-# RULES
+"FPS specialise break (==x)" forall x.
+ break (==x) = breakByte x
+ #-}
#endif
-- | 'breakByte' breaks its ByteString argument at the first occurence
#endif
-- | 'breakByte' breaks its ByteString argument at the first occurence
@@
-1063,10
+1063,10
@@
spanByte c ps@(PS x s l) = inlinePerformIO $ withForeignPtr x $ \p ->
#-}
#if __GLASGOW_HASKELL__ >= 605
#-}
#if __GLASGOW_HASKELL__ >= 605
--- {-# RULES
--- "FPS specialise span (==x)" forall x.
--- span (==x) = spanByte x
--- #-}
+{-# RULES
+"FPS specialise span (==x)" forall x.
+ span (==x) = spanByte x
+ #-}
#endif
-- | 'spanEnd' behaves like 'span' but from the end of the 'ByteString'.
#endif
-- | 'spanEnd' behaves like 'span' but from the end of the 'ByteString'.
@@
-1435,6
+1435,14
@@
filterByte w ps = replicate (count w ps) w
"FPS specialise filter (== x)" forall x.
filter ((==) x) = filterByte x
#-}
"FPS specialise filter (== x)" forall x.
filter ((==) x) = filterByte x
#-}
+
+#if __GLASGOW_HASKELL__ >= 605
+{-# RULES
+"FPS specialise filter (== x)" forall x.
+ filter (== x) = filterByte x
+ #-}
+#endif
+
--
-- | /O(n)/ A first order equivalent of /filter . (\/=)/, for the common
-- case of filtering a single byte out of a list. It is more efficient
--
-- | /O(n)/ A first order equivalent of /filter . (\/=)/, for the common
-- case of filtering a single byte out of a list. It is more efficient
@@
-1448,9
+1456,17
@@
filterNotByte w = filter (/= w)
{-# INLINE filterNotByte #-}
{-# RULES
{-# INLINE filterNotByte #-}
{-# RULES
-"FPS specialise filter (/= x)" forall x.
+"FPS specialise filter (x /=)" forall x.
filter ((/=) x) = filterNotByte x
#-}
filter ((/=) x) = filterNotByte x
#-}
+
+#if __GLASGOW_HASKELL__ >= 605
+{-# RULES
+"FPS specialise filter (/= x)" forall x.
+ filter (/= x) = filterNotByte x
+ #-}
+#endif
+
-- | /O(n)/ The 'find' function takes a predicate and a ByteString,
-- and returns the first element in matching the predicate, or 'Nothing'
-- if there is no such element.
-- | /O(n)/ The 'find' function takes a predicate and a ByteString,
-- and returns the first element in matching the predicate, or 'Nothing'
-- if there is no such element.