[replace more Prelude functions with more efficient versions
John Meacham <john@repetae.net>**20061121225201] hunk ./lib/base/Jhc/Basics.hs 129
-zip              :: [a] -> [b] -> [(a,b)]
-zip              =  zipWith (\a b -> (a,b))
+zip :: [a] -> [b] -> [(a,b)]
+zip (a:as) (b:bs) = (a,b) : zip as bs
+zip _      _      = []
hunk ./lib/base/Jhc/Basics.hs 139
-zipWith z (a:as) (b:bs)
-                 =  z a b : zipWith z as bs
+zipWith z (a:as) (b:bs) =  z a b : zipWith z as bs
hunk ./lib/base/Prelude.hs 1
+{-# OPTIONS_JHC -funboxed-tuples #-}
hunk ./lib/base/Prelude.hs 349
-last [x]         =  x
-last (_:xs)      =  last xs
hunk ./lib/base/Prelude.hs 350
+last (x:xs)      = last' x xs where
+    last' x []     = x
+    last' _ (y:ys) = last' y xs
hunk ./lib/base/Prelude.hs 356
-init [x]         =  []
-init (x:xs)      =  x : init xs
hunk ./lib/base/Prelude.hs 357
+init (x:xs)      =  init' x xs where
+    init' _ [] = []
+    init' y (z:zs) = y:init' z zs
hunk ./lib/base/Prelude.hs 372
---length []        =  0
---length (_:l)     =  1 + length l
hunk ./lib/base/Prelude.hs 373
--- List index (subscript) operator, 0-origin
-
---(!!)                :: [a] -> Int -> a
---xs     !! n | n < 0 =  error "Prelude.!!: negative index"
---[]     !! _         =  error "Prelude.!!: index too large"
---(x:_)  !! 0         =  x
---(_:xs) !! n         =  xs !! (n-1)
-
---xs !! n | n < 0   =  error "Prelude.(!!): negative index\n"
---	| otherwise =  sub xs n where
---			    sub :: [a] -> Int -> a
---                            sub []     _ = error "Prelude.(!!): index too large\n"
---                            sub (y:ys) n = if n == 0
---					   then y
---					   else sub ys $! (n - 1)
hunk ./lib/base/Prelude.hs 428
-replicate n x    =  take n (repeat x)
+replicate n x    = f n where
+    f n | n <= 0 = []
+    f n = let n' = n - 1 in n' `seq` (x:f n')
hunk ./lib/base/Prelude.hs 463
-splitAt n xs             =  (take n xs, drop n xs)
+--splitAt n xs             =  (take n xs, drop n xs)
+splitAt n ls | n < 0	= ([], ls)
+splitAt n ls = splitAt' n ls where
+    splitAt' :: Int -> [a] -> ([a], [a])
+    splitAt' 0  xs  = ([], xs)
+    splitAt' _  []  = ([], [])
+    splitAt' m (x:xs) = case splitAt' (m - 1) xs of
+        (xs', xs'') -> (x:xs', xs'')
hunk ./lib/base/Prelude.hs 541
-elem x           =  any (== x)
-notElem x        =  all (/= x)
+--elem x           =  any (== x)
+--notElem x        =  all (/= x)
+elem _ []	= False
+elem x (y:ys)	= x==y || elem x ys
+
+notElem	_ []	=  True
+notElem x (y:ys)=  x /= y && notElem x ys