[commit: ghc] master: testsuite/spec001: untabify, kill trailing whitespace (31dd5e5)
git at git.haskell.org
git at git.haskell.org
Sun Apr 20 21:56:08 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/31dd5e5db965fa9ed30ac5b58514668f92843c01/ghc
>---------------------------------------------------------------
commit 31dd5e5db965fa9ed30ac5b58514668f92843c01
Author: Austin Seipp <austin at well-typed.com>
Date: Sun Apr 20 16:55:14 2014 -0500
testsuite/spec001: untabify, kill trailing whitespace
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
31dd5e5db965fa9ed30ac5b58514668f92843c01
.../tests/simplCore/should_compile/spec001.hs | 182 ++++++++++----------
1 file changed, 91 insertions(+), 91 deletions(-)
diff --git a/testsuite/tests/simplCore/should_compile/spec001.hs b/testsuite/tests/simplCore/should_compile/spec001.hs
index c4f9205..f4b4dd0 100644
--- a/testsuite/tests/simplCore/should_compile/spec001.hs
+++ b/testsuite/tests/simplCore/should_compile/spec001.hs
@@ -12,77 +12,77 @@
module Data.PackedString.Latin1 (
- -- * The @PackedString@ type
+ -- * The @PackedString@ type
PackedString, -- abstract, instances: Eq, Ord, Show, Typeable
-- * Converting to and from @PackedString at s
- pack,
- unpack,
-
- -- * I\/O with @PackedString at s
- hPut, hGet,
-
- -- * List-like manipulation functions
- nil,
- cons,
- head,
- tail,
- null,
- append,
- length,
- index,
- map,
- filter,
- reverse,
- concat,
- elem,
- substr,
- take,
- drop,
- splitAt,
- foldl,
- foldr,
- takeWhile,
- dropWhile,
- span,
- break,
- lines,
- unlines,
- words,
- unwords,
- split,
- splitWith,
- join,
--- unpackList, -- eek, otherwise it gets thrown away by the simplifier
+ pack,
+ unpack,
+
+ -- * I\/O with @PackedString at s
+ hPut, hGet,
+
+ -- * List-like manipulation functions
+ nil,
+ cons,
+ head,
+ tail,
+ null,
+ append,
+ length,
+ index,
+ map,
+ filter,
+ reverse,
+ concat,
+ elem,
+ substr,
+ take,
+ drop,
+ splitAt,
+ foldl,
+ foldr,
+ takeWhile,
+ dropWhile,
+ span,
+ break,
+ lines,
+ unlines,
+ words,
+ unwords,
+ split,
+ splitWith,
+ join,
+-- unpackList, -- eek, otherwise it gets thrown away by the simplifier
) where
import qualified Prelude
import Prelude hiding (
- head,
- tail,
- null,
- length,
- (!!),
- map,
- filter,
- reverse,
- concat,
- elem,
- take,
- drop,
- foldl,
- foldr,
- splitAt,
- takeWhile,
- dropWhile,
- span,
- break,
- lines,
- unlines,
- words,
- unwords,
- join
+ head,
+ tail,
+ null,
+ length,
+ (!!),
+ map,
+ filter,
+ reverse,
+ concat,
+ elem,
+ take,
+ drop,
+ foldl,
+ foldr,
+ splitAt,
+ takeWhile,
+ dropWhile,
+ span,
+ break,
+ lines,
+ unlines,
+ words,
+ unwords,
+ join
)
import GHC.Exts
@@ -100,11 +100,11 @@ import System.IO
-- various efficient operations. A 'PackedString' contains Latin1
-- (8-bit) characters only.
data PackedString = PS {-#UNPACK#-}!Int {-#UNPACK#-}!Int
- {-#UNPACK#-}!(ForeignPtr Word8)
- -- this is a pretty efficient representation, and can be
- -- converted to/from a StorableArray.
- -- When the ForeignPtr is unpacked, we get the Addr# stored
- -- directly in the PS constructor.
+ {-#UNPACK#-}!(ForeignPtr Word8)
+ -- this is a pretty efficient representation, and can be
+ -- converted to/from a StorableArray.
+ -- When the ForeignPtr is unpacked, we get the Addr# stored
+ -- directly in the PS constructor.
-- Perhaps making a slice should be conditional on the ratio of the
-- slice/string size to limit memory leaks.
@@ -117,9 +117,9 @@ instance Ord PackedString where
comparePS (PS off1 len1 fp1) (PS off2 len2 fp2)
= inlinePerformIO $
- withForeignPtr fp1 $ \p1 ->
- withForeignPtr fp2 $ \p2 ->
- cmp (p1 `plusPtr` off1) (p2 `plusPtr` off2) len1
+ withForeignPtr fp1 $ \p1 ->
+ withForeignPtr fp2 $ \p2 ->
+ cmp (p1 `plusPtr` off1) (p2 `plusPtr` off2) len1
where
cmp :: Ptr Word8 -> Ptr Word8 -> Int -> IO Ordering
cmp p1 p2 n
@@ -129,9 +129,9 @@ comparePS (PS off1 len1 fp1) (PS off2 len2 fp2)
a <- peekElemOff p1 n
b <- peekElemOff p2 n
case a `compare` b of
- EQ -> cmp p1 p2 (n+1)
- LT -> return LT
- GT -> return GT
+ EQ -> cmp p1 p2 (n+1)
+ LT -> return LT
+ GT -> return GT
--instance Read PackedString: ToDo
@@ -146,8 +146,8 @@ deriving instance Typeable PackedString
-- | The 'nilPS' value is the empty string.
nil :: PackedString
nil = inlinePerformIO $ do
- fp <- newForeignPtr_ nullPtr
- return (PS 0 0 fp)
+ fp <- newForeignPtr_ nullPtr
+ return (PS 0 0 fp)
-- | The 'consPS' function prepends the given character to the
-- given string.
@@ -159,8 +159,8 @@ packLen :: Int -> String -> PackedString
packLen len str = inlinePerformIO $ do
fp <- mallocForeignPtrBytes len
withForeignPtr fp $ \p -> do
- fill_it_in p 0 str
- return (PS 0 len fp)
+ fill_it_in p 0 str
+ return (PS 0 len fp)
fill_it_in p i [] = return ()
fill_it_in p i (c:cs) = do pokeElemOff p i (c2w c); fill_it_in p (i+1) cs
@@ -246,7 +246,7 @@ take :: Int -> PackedString -> PackedString
take n ps = substr ps 0 (n-1)
-- | The 'drop' function drops the first @n@ characters of a 'PackedString'.
-drop :: Int -> PackedString -> PackedString
+drop :: Int -> PackedString -> PackedString
drop n ps = substr ps n (length ps - 1)
-- | The 'splitWith' function splits a 'PackedString' at a given index.
@@ -334,15 +334,15 @@ splitWith' pred off len fp =
withPackedString fp $ \p -> splitLoop pred p 0 off len fp
splitLoop pred p idx off len fp
- | p `seq` idx `seq` off `seq` fp `seq` False = undefined
+ | p `seq` idx `seq` off `seq` fp `seq` False = undefined
splitLoop pred p idx off len fp
- | idx >= len = return [PS off idx fp]
- | otherwise = do
- w <- peekElemOff p (off+idx)
- if pred (w2c w)
- then return (PS off idx fp :
- splitWith' pred (off+idx+1) (len-idx-1) fp)
- else splitLoop pred p (idx+1) off len fp
+ | idx >= len = return [PS off idx fp]
+ | otherwise = do
+ w <- peekElemOff p (off+idx)
+ if pred (w2c w)
+ then return (PS off idx fp :
+ splitWith' pred (off+idx+1) (len-idx-1) fp)
+ else splitLoop pred p (idx+1) off len fp
-- -----------------------------------------------------------------------------
-- Local utility functions
@@ -399,9 +399,9 @@ unpackList :: PackedString -> [Char]
unpackList (PS off len fp) =
withPackedString fp $ \p -> do
let loop p (-1) acc = return acc
- loop p n acc = do
+ loop p n acc = do
a <- peekElemOff p n
- loop p (n-1) (w2c a : acc)
+ loop p (n-1) (w2c a : acc)
loop (p `plusPtr` off) (len-1) []
{-# INLINE [0] unpackFoldr #-}
@@ -409,9 +409,9 @@ unpackFoldr :: PackedString -> (Char -> a -> a) -> a -> a
unpackFoldr (PS off len fp) f c =
withPackedString fp $ \p -> do
let loop p (-1) acc = return acc
- loop p n acc = do
+ loop p n acc = do
a <- peekElemOff p n
- loop p (n-1) (w2c a `f` acc)
+ loop p (n-1) (w2c a `f` acc)
loop (p `plusPtr` off) (len-1) c
-- -----------------------------------------------------------------------------
More information about the ghc-commits
mailing list