break

break :: (a -> Bool) -> [a] -> ([a], [a])
base Prelude, base Data.List
break, applied to a predicate p and a list xs, returns a tuple (possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list: > break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4]) > break (< 9) [1,2,3] == ([],[1,2,3]) > break (> 9) [1,2,3] == ([1,2,3],[]) break p is equivalent to span (not . p).
break :: (Char -> Bool) -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString.Char8, bytestring Data.ByteString.Lazy.Char8
break p is equivalent to span (not . p).
break :: (Char -> Bool) -> Text -> (Text, Text)
text Data.Text, text Data.Text.Lazy
O(n) break is like span, but the prefix returned is over elements that fail the predicate p.
break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString.Lazy
break p is equivalent to span (not . p).
break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString
break p is equivalent to span (not . p). Under GHC, a rewrite rule will transform break (==) into a call to the specialised breakByte: > break ((==) x) = breakByte x > break (==x) = breakByte x
breakByte :: Word8 -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString
breakByte breaks its ByteString argument at the first occurence of the specified byte. It is more efficient than break as it is implemented with memchr(3). I.e. > break (=='c') "abcd" == breakByte 'c' "abcd"
breakEnd :: (Char -> Bool) -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString.Char8
breakEnd behaves like break but from the end of the ByteString breakEnd p == spanEnd (not.p)
breakEnd :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString
breakEnd behaves like break but from the end of the ByteString breakEnd p == spanEnd (not.p)
breakl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
containers Data.Sequence
O(i) applied to a predicate p and a sequence xs, returns a pair whose first element is the longest prefix (possibly empty) of xs of elements that do not satisfy p and the second element is the remainder of the sequence. breakl p is equivalent to spanl (not . p).
breakOn :: Text -> Text -> (Text, Text)
text Data.Text
O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match. Examples: > breakOn "::" "a::b::c" ==> ("a", "::b::c") > breakOn "/" "foobar" ==> ("foobar", "") Laws: > append prefix match == haystack > If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead. In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
breakOn :: Text -> Text -> (Text, Text)
text Data.Text.Lazy
O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match. Examples: > breakOn "::" "a::b::c" ==> ("a", "::b::c") > breakOn "/" "foobar" ==> ("foobar", "") Laws: > append prefix match == haystack > If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead. This function is strict in its first argument, and lazy in its second. In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
breakOnAll :: Text -> Text -> [(Text, Text)]
text Data.Text
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair: * The entire string prior to the kth match (i.e. the prefix) * The kth match, followed by the remainder of the string Examples: > breakOnAll "::" "" > ==> [] > breakOnAll "/" "a/b/c/" > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")] In (unlikely) bad cases, this function's time complexity degrades towards O(n*m). The needle parameter may not be empty.
breakOnAll :: Text -> Text -> [(Text, Text)]
text Data.Text.Lazy
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair: * The entire string prior to the kth match (i.e. the prefix) * The kth match, followed by the remainder of the string Examples: > breakOnAll "::" "" > ==> [] > breakOnAll "/" "a/b/c/" > ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")] This function is strict in its first argument, and lazy in its second. In (unlikely) bad cases, this function's time complexity degrades towards O(n*m). The needle parameter may not be empty.
breakOnEnd :: Text -> Text -> (Text, Text)
text Data.Text, text Data.Text.Lazy
O(n+m) Similar to breakOn, but searches from the end of the string. The first element of the returned tuple is the prefix of haystack up to and including the last match of needle. The second is the remainder of haystack, following the match. > breakOnEnd "::" "a::b::c" ==> ("a::b::", "c")
package breakout
package
A simple Breakout game implementation. Version 0.0.2
breakpoint :: a -> a
base GHC.Exts
breakpointCond :: Bool -> a -> a
base GHC.Exts
breakpointTrap :: Signal
unix System.Posix.Signals
breakr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
containers Data.Sequence
breakr p is equivalent to spanr (not . p).
breakSubstring :: ByteString -> ByteString -> (ByteString, ByteString)
bytestring Data.ByteString, bytestring Data.ByteString.Char8
otherwise -> Just (length x) </pre> For example, to tokenise a string, dropping delimiters: > tokenise x y = h (:) if null t then [] else tokenise x (drop (length x) t) > To skip to the first occurence of a string: > snd (breakSubstring x y) To take the parts of a string before a delimiter: > fst (breakSubstring x y)

Show more results