Skip to content

Commit

Permalink
Drop trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Jun 29, 2012
1 parent 26c0482 commit 716ce6b
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions Data/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ module Data.Text
, partition

-- , findSubstring

-- * Indexing
-- $index
, index
Expand Down Expand Up @@ -330,7 +330,7 @@ instance NFData Text

-- This instance preserves data abstraction at the cost of inefficiency.
-- We omit reflection services for the sake of data abstraction.
--
--
-- This instance was created by copying the behavior of Data.Set and
-- Data.Map. If you feel a mistake has been made, please feel free to
-- submit improvements.
Expand Down Expand Up @@ -1129,7 +1129,7 @@ findAIndexOrEnd q t@(Text _arr _off len) = go 0
where go !i | i >= len || q c = i
| otherwise = go (i+d)
where Iter c d = iter t i

-- | /O(n)/ Group characters in a string by equality.
group :: Text -> [Text]
group = groupBy (==)
Expand Down Expand Up @@ -1162,7 +1162,7 @@ tails t | null t = [empty]
-- > splitOn "\r\n" "a\r\nb\r\nd\r\ne" == ["a","b","d","e"]
-- > splitOn "aaa" "aaaXaaaXaaaXaaa" == ["","X","X","X",""]
-- > splitOn "x" "x" == ["",""]
--
--
-- and
--
-- > intercalate s . splitOn s == id
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Encoding/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ showUnicodeException (EncodeError desc (Just c))
= "Cannot encode character '\\x" ++ showHex (fromEnum c) ("': " ++ desc)
showUnicodeException (EncodeError desc Nothing)
= "Cannot encode input: " ++ desc

instance Show UnicodeException where
show = showUnicodeException

Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Encoding/Utf8.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ validate3 x1 x2 x3 = validate3_1 || validate3_2 || validate3_3 || validate3_4
validate4 :: Word8 -> Word8 -> Word8 -> Word8 -> Bool
{-# INLINE validate4 #-}
validate4 x1 x2 x3 x4 = validate4_1 || validate4_2 || validate4_3
where
where
validate4_1 = x1 == 0xF0 &&
between x2 0x90 0xBF &&
between x3 0x80 0xBF &&
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Fusion/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ lengthI (Stream next s0 _len) = loop_length 0 s0
-- of 'lengthI', but can short circuit if the count of characters is
-- greater than the number, and hence be more efficient.
compareLengthI :: Integral a => Stream Char -> a -> Ordering
compareLengthI (Stream next s0 len) n =
compareLengthI (Stream next s0 len) n =
case exactly len of
Nothing -> loop_cmp 0 s0
Just i -> compare (fromIntegral i) n
Expand Down
10 changes: 5 additions & 5 deletions Data/Text/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module Data.Text.IO
(
-- * Performance
-- $performance
-- $performance

-- * Locale support
-- $locale
Expand Down Expand Up @@ -133,7 +133,7 @@ hGetContents h = do
ts <- readChunks
(hh', _) <- hClose_help hh
return (hh'{haType=ClosedHandle}, T.concat ts)

-- | Use a more efficient buffer size if we're reading in
-- block-buffered mode with the default buffer size. When we can
-- determine the size of the handle we're reading, set the buffer size
Expand Down Expand Up @@ -167,7 +167,7 @@ hPutStr h = B.hPutStr h . encodeUtf8
#else
-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
hPutStr h t = do
(buffer_mode, nl) <-
(buffer_mode, nl) <-
wantWritableHandle "hPutStr" h $ \h_ -> do
bmode <- getSpareBuffer h_
return (bmode, haOutputNL h_)
Expand Down Expand Up @@ -249,7 +249,7 @@ writeBlocksRaw h buf0 (Stream next0 s0 _len) = outer s0 buf0

-- This function is completely lifted from GHC.IO.Handle.Text.
getSpareBuffer :: Handle__ -> IO (BufferMode, CharBuffer)
getSpareBuffer Handle__{haCharBuffer=ref,
getSpareBuffer Handle__{haCharBuffer=ref,
haBuffers=spare_ref,
haBufferMode=mode}
= do
Expand All @@ -270,7 +270,7 @@ getSpareBuffer Handle__{haCharBuffer=ref,
-- This function is completely lifted from GHC.IO.Handle.Text.
commitBuffer :: Handle -> RawCharBuffer -> Int -> Int -> Bool -> Bool
-> IO CharBuffer
commitBuffer hdl !raw !sz !count flush release =
commitBuffer hdl !raw !sz !count flush release =
wantWritableHandle "commitAndReleaseBuffer" hdl $
commitBuffer' raw sz count flush release
{-# INLINE commitBuffer #-}
Expand Down
4 changes: 2 additions & 2 deletions Data/Text/IO/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ hGetLineLoop hh@Handle__{..} = go where
maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
maybeFillReadBuffer handle_ buf
= catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
if isEOFError e
then return Nothing
if isEOFError e
then return Nothing
else ioError e

unpack :: RawCharBuffer -> Int -> Int -> IO Text
Expand Down
6 changes: 3 additions & 3 deletions Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ module Data.Text.Lazy
, partition

-- , findSubstring

-- * Indexing
, index
, count
Expand Down Expand Up @@ -921,7 +921,7 @@ drop i t0
| otherwise = drop' i t0
where drop' 0 ts = ts
drop' _ Empty = Empty
drop' n (Chunk t ts)
drop' n (Chunk t ts)
| n < len = Chunk (T.drop (fromIntegral n) t) ts
| otherwise = drop' (n - len) ts
where len = fromIntegral (T.length t)
Expand Down Expand Up @@ -1209,7 +1209,7 @@ tails ts@(Chunk t ts')
-- > splitOn "\r\n" "a\r\nb\r\nd\r\ne" == ["a","b","d","e"]
-- > splitOn "aaa" "aaaXaaaXaaaXaaa" == ["","X","X","X",""]
-- > splitOn "x" "x" == ["",""]
--
--
-- and
--
-- > intercalate s . splitOn s == id
Expand Down
8 changes: 4 additions & 4 deletions Data/Text/Lazy/Builder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- Module : Data.Text.Lazy.Builder
-- Copyright : (c) 2010 Johan Tibell
-- License : BSD3-style (see LICENSE)
--
--
-- Maintainer : Johan Tibell <johan.tibell@gmail.com>
-- Stability : experimental
-- Portability : portable to Hugs and GHC
Expand Down Expand Up @@ -139,7 +139,7 @@ append (Builder f) (Builder g) = Builder (f . g)

-- TODO: Experiment to find the right threshold.
copyLimit :: Int
copyLimit = 128
copyLimit = 128

-- This function attempts to merge small @Text@ values instead of
-- treating each value as its own chunk. We may not always want this.
Expand Down Expand Up @@ -292,14 +292,14 @@ append' (Builder f) (Builder g) = Builder (f . g)
"append/writeAtMost" forall a b (f::forall s. A.MArray s -> Int -> ST s Int)
(g::forall s. A.MArray s -> Int -> ST s Int) ws.
append (writeAtMost a f) (append (writeAtMost b g) ws) =
append (writeAtMost (a+b) (\marr o -> f marr o >>= \ n ->
append (writeAtMost (a+b) (\marr o -> f marr o >>= \ n ->
g marr (o+n) >>= \ m ->
let s = n+m in s `seq` return s)) ws

"writeAtMost/writeAtMost" forall a b (f::forall s. A.MArray s -> Int -> ST s Int)
(g::forall s. A.MArray s -> Int -> ST s Int).
append (writeAtMost a f) (writeAtMost b g) =
writeAtMost (a+b) (\marr o -> f marr o >>= \ n ->
writeAtMost (a+b) (\marr o -> f marr o >>= \ n ->
g marr (o+n) >>= \ m ->
let s = n+m in s `seq` return s)

Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Lazy/Encoding/Fusion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- Copyright : (c) 2009, 2010 Bryan O'Sullivan
--
-- License : BSD-style
-- Maintainer : bos@serpentine.com, rtomharper@googlemail.com,
-- Maintainer : bos@serpentine.com, rtomharper@googlemail.com,
-- duncan@haskell.org
-- Stability : experimental
-- Portability : portable
Expand Down
4 changes: 2 additions & 2 deletions Data/Text/Lazy/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module Data.Text.Lazy.IO
(
-- * Performance
-- $performance
-- $performance

-- * Locale support
-- $locale
Expand Down Expand Up @@ -119,7 +119,7 @@ lazyRead h = unsafeInterleaveIO $
case haType hh of
ClosedHandle -> return (hh, L.empty)
SemiClosedHandle -> lazyReadBuffered h hh
_ -> ioException
_ -> ioException
(IOError (Just h) IllegalOperation "hGetContents"
"illegal handle type" Nothing Nothing)

Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Lazy/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- duncan@haskell.org
-- Stability : experimental
-- Portability : GHC
--
--
-- A module containing private 'Text' internals. This exposes the
-- 'Text' representation and low level construction functions.
-- Modules which extend the 'Text' system may need to use this module.
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Search.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-- Horspool, Sunday, and Lundh.
--
-- References:
--
--
-- * R. S. Boyer, J. S. Moore: A Fast String Searching Algorithm.
-- Communications of the ACM, 20, 10, 762-772 (1977)
--
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Unsafe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Data.Text.Unsafe
, takeWord16
, dropWord16
) where

#if defined(ASSERTS)
import Control.Exception (assert)
#endif
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Unsafe/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Data.Text.Unsafe.Base
inlineInterleaveST
, inlinePerformIO
) where

import GHC.ST (ST(..))
#if defined(__GLASGOW_HASKELL__)
# if __GLASGOW_HASKELL__ >= 611
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/haskell/Benchmarks/Programs/StripTags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
module Benchmarks.Programs.StripTags
( benchmark
) where

import Criterion (Benchmark, bgroup, bench)
import Data.List (mapAccumL)
import System.IO (Handle, hPutStr)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/haskell/Benchmarks/ReadNumbers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ text reader = foldl' go 1000000
where
go z t = case reader t of Left _ -> z
Right (n, _) -> min n z

byteString :: (Ord a, Num a) => (t -> Maybe (a,t)) -> [t] -> a
byteString reader = foldl' go 1000000
where
Expand Down
2 changes: 1 addition & 1 deletion cbits/cbits.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static const uint8_t utf8d[] = {
12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,
12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12,
12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12,
12,36,12,12,12,12,12,12,12,12,12,12,
12,36,12,12,12,12,12,12,12,12,12,12,
};

static inline uint32_t
Expand Down
2 changes: 1 addition & 1 deletion scripts/Arsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Text.ParserCombinators.Parsec.Prim hiding ((<|>), many)
instance Applicative (GenParser s a) where
pure = return
(<*>) = ap

instance Alternative (GenParser s a) where
empty = mzero
(<|>) = mplus
Expand Down
12 changes: 6 additions & 6 deletions tests/Tests/QuickCheckUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Tests.QuickCheckUtils
, eqP

, Encoding (..)

, write_read
) where

Expand Down Expand Up @@ -67,7 +67,7 @@ genUnicode = fmap fromString string where
string = sized $ \n ->
do k <- choose (0,n)
sequence [ char | _ <- [1..k] ]

excluding :: [a -> Bool] -> Gen a -> Gen a
excluding bad gen = loop
where
Expand All @@ -76,14 +76,14 @@ genUnicode = fmap fromString string where
if or (map ($ x) bad)
then loop
else return x

reserved = [lowSurrogate, highSurrogate, noncharacter]
lowSurrogate c = c >= 0xDC00 && c <= 0xDFFF
highSurrogate c = c >= 0xD800 && c <= 0xDBFF
noncharacter c = masked == 0xFFFE || masked == 0xFFFF
where
masked = c .&. 0xFFFF
masked = c .&. 0xFFFF

ascii = choose (0,0x7F)
plane0 = choose (0xF0, 0xFFFF)
plane1 = oneof [ choose (0x10000, 0x10FFF)
Expand All @@ -109,7 +109,7 @@ genUnicode = fmap fromString string where
]
plane14 = choose (0xE0000, 0xE0FFF)
planes = [ascii, plane0, plane1, plane2, plane14]

char = chr `fmap` excluding reserved (oneof planes)

-- For tests that have O(n^2) running times or input sizes, resize
Expand Down
4 changes: 2 additions & 2 deletions text.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.11.2.2
homepage: https://github.com/bos/text
bug-reports: https://github.com/bos/text/issues
synopsis: An efficient packed Unicode text type.
description:
description:
.
An efficient packed, immutable Unicode text type (both strict and
lazy), with a powerful loop fusion optimization framework.
Expand Down Expand Up @@ -148,7 +148,7 @@ library
else
cpp-options: -DINTEGER_GMP
build-depends: integer-gmp >= 0.2 && < 0.5


if impl(ghc >= 6.9) && impl(ghc < 6.11)
cpp-options: -DINTEGER_GMP
Expand Down

0 comments on commit 716ce6b

Please sign in to comment.