# Ticket #974: partitionEithers.patch

File partitionEithers.patch, 37.3 KB (added by guest, 11 years ago)
Line
1
2New patches:
3
5Russell O'Connor <roconnor@theorem.ca>**20061103145040] {
6hunk ./Data/Either.hs 18
7-   either      -- :: (a -> c) -> (b -> c) -> Either a b -> c
8+   either,     -- :: (a -> c) -> (b -> c) -> Either a b -> c
9+   lefts,      -- :: [Either a b] -> [a]
10+   rights,     -- :: [Either a b] -> [b]
11+   partitionEithers,   -- :: [Either a b] -> ([a],[b])
12hunk ./Data/Either.hs 24
13+{-
14+-- just for testing
15+import Test.QuickCheck
16+-}
17+
18hunk ./Data/Either.hs 52
19+-- | Extracts from a list of 'Either' all the 'Left' elements
20+-- All the 'Left' elements are extracted in order.
21+
22+lefts   :: [Either a b] -> [a]
23+lefts x = [a | Left a <- x]
24+
25+-- | Extracts from a list of 'Either' all the 'Right' elements
26+-- All the 'Right' elements are extracted in order.
27+
28+rights   :: [Either a b] -> [b]
29+rights x = [a | Right a <- x]
30+
31+-- | Partitions a list of 'Either' into two lists
32+-- All the 'Left' elements are extracted, in order, to the first
33+-- component of the output.  Similarly the 'Right' elements are extracted
34+-- to the second component of the output.
35+
36+partitionEithers :: [Either a b] -> ([a],[b])
37+partitionEithers = foldr (either left right) ([],[])
38+ where
39+  left  a (l, r) = (a:l, r)
40+  right a (l, r) = (l, a:r)
41+
42+{-
43+{--------------------------------------------------------------------
44+  Testing
45+--------------------------------------------------------------------}
46+prop_partitionEithers :: [Either Int Int] -> Bool
47+prop_partitionEithers x =
48+  partitionEithers x == (lefts x, rights x)
49+-}
50+
51}
52
53Context:
54
55[Add intercalate and split to Data.List
56Josef Svenningsson <josef.svenningsson@gmail.com>*-20061024172357]
57[Data.Generics.Basics is GHC-only
58Ross Paterson <ross@soi.city.ac.uk>**20061102111736]
59[#ifdef around non-portable Data.Generics.Basics
60Malcolm.Wallace@cs.york.ac.uk**20061102103445]
62simonpj@microsoft**20061101102059]
63[minor clarification of RandomGen doc
64Ross Paterson <ross@soi.city.ac.uk>**20061030230842]
65[rearrange docs a bit
66Ross Paterson <ross@soi.city.ac.uk>**20061030161223]
67[Add intercalate and split to Data.List
68Josef Svenningsson <josef.svenningsson@gmail.com>**20061024172357]
69[Export pseq from Control.Parallel, and use it in Control.Parallel.Strategies
70Simon Marlow <simonmar@microsoft.com>**20061027150141]
71[`par` should be infixr 0
72Simon Marlow <simonmar@microsoft.com>**20061027130800
73 Alas, I didn't spot this due to lack of testing, and the symptom is
74 that an expression like x `par` y `seq z will have exactly the wrong
75 parallelism properties.  The workaround is to add parantheses.
76
77 I think we could push this to the 6.6 branch.
78]
79[fix example in comment
80Ross Paterson <ross@soi.city.ac.uk>**20061023163925]
81[Use the new Any type for dynamics (GHC only)
82simonpj@microsoft**20061019160408]
84Malcolm.Wallace@cs.york.ac.uk**20061012135200]
85[Remove Data.FiniteMap, add Control.Applicative, Data.Traversable, and
86Malcolm.Wallace@cs.york.ac.uk**20061012095605
87 Data.Foldable to the nhc98 build.
88]
89[STM invariants
90tharris@microsoft.com**20061007123253]
91[Inline shift in GHC's Bits instances for {Int,Word}{,8,16,32,64}
92Samuel Bronson <naesten@gmail.com>**20061009020906]
93[Don't create GHC.Prim when bootstrapping; we can't, and we don't need it
94Ian Lynagh <igloo@earth.li>**20061004165355]
95[Data.ByteString: fix lazyness of take, drop & splitAt
96Don Stewart <dons@cse.unsw.edu.au>**20061005011703
97
98 ByteString.Lazy's take, drop and splitAt were too strict when demanding
99 a byte string. Spotted by Einar Karttunen. Thanks to him and to Bertram
100 Felgenhauer for explaining the problem and the fix.
101
102]
103[Fix syntax error that prevents building Haddock documentation on Windows
104brianlsmith@gmail.com**20060917013530]
105[Hugs only: unbreak typeRepKey
106Ross Paterson <ross@soi.city.ac.uk>**20060929102743]
107[make hGetBufNonBlocking do something on Windows w/ -threaded
108Simon Marlow <simonmar@microsoft.com>**20060927145811
109 hGetBufNonBlocking will behave the same as hGetBuf on Windows now, which
110 is better than just crashing (which it did previously).
111]
112[add typeRepKey :: TypeRep -> IO Int
113Simon Marlow <simonmar@microsoft.com>**20060927100342
114 See feature request #880
115]
117Ross Paterson <ross@soi.city.ac.uk>**20060926135843]
118[Add strict versions of insertWith and insertWithKey (Data.Map)
119jeanphilippe.bernardy@gmail.com**20060910162443]
120[doc tweaks, including more precise equations for evaluate
121Ross Paterson <ross@soi.city.ac.uk>**20060910115259]
122[Sync Data.ByteString with stable branch
123Don Stewart <dons@cse.unsw.edu.au>**20060909050111
124
125 This patch:
126     * hides the LPS constructor (its in .Base if you need it)
127     * adds functions to convert between strict and lazy bytestrings
129
130]
131[Typeable1 instances for STM and TVar
132Ross Paterson <ross@soi.city.ac.uk>**20060904231425]
133[remove obsolete Hugs stuff
134Ross Paterson <ross@soi.city.ac.uk>**20060904223944]
135[Cleaner isInfixOf suggestion from Ross Paterson
136John Goerzen <jgoerzen@complete.org>**20060901143654]
137[New function isInfixOf that searches a list for a given sublist
138John Goerzen <jgoerzen@complete.org>**20060831151556
139
140 Example:
141
143 isInfixOf "Ial" "I really like Haskell." -> False
144
145 This function was first implemented in MissingH as MissingH.List.contains
146]
147[Better doc on Data.Map.lookup: explain what the monad is for
148jeanphilippe.bernardy@gmail.com**20060903133440]
149[fix hDuplicateTo on Windows
150Simon Marlow <simonmar@microsoft.com>**20060901150016
151 deja vu - I'm sure I remember fixing this before...
152]
153[Improve documentation of atomically
154simonpj@microsoft**20060714120207]
155[Add missing method genRange for StdGen (fixes #794)
156simonpj@microsoft**20060707151901
157
158        MERGE TO STABLE
159
160 Trac #794 reports (correctly) that the implementation of StdGen
161 only returns numbers in the range (0..something) rather than
162 (minBound, maxBound), which is what StdGen's genRange claims.
163
164 This commit fixes the problem, by implementing genRange for StdGen
165 (previously it just used the default method).
166
167
168]
169[mark nhc98 import hack
170Ross Paterson <ross@soi.city.ac.uk>**20060831125219]
172Simon Marlow <simonmar@microsoft.com>**20060831104200]
173[import Control.Arrow.ArrowZero to help nhc98's type checker
174Malcolm.Wallace@cs.york.ac.uk**20060831101105]
175[remove Text.Regex(.Posix) from nhc98 build
176Malcolm.Wallace@cs.york.ac.uk**20060831101016]
178Ross Paterson <ross@soi.city.ac.uk>**20060830163521]
179[fix doc typo
180Ross Paterson <ross@soi.city.ac.uk>**20060830134123]
182Ross Paterson <ross@soi.city.ac.uk>**20060830133805
183
185]
186[Make length a good consumer
187simonpj@microsoft*-20060508142726
188
189 Make length into a good consumer.  Fixes Trac bug #707.
190
191 (Before length simply didn't use foldr.)
192
193]
195Don Stewart <dons@cse.unsw.edu.au>**20060824081118
196
197 flip mapM_ is more and more common, I find. Several suggestions have
198 been made to add this, as foreach or something similar. This patch
199 does just that:
200
201     forM  :: (Monad m) => [a] -> (a -> m b) -> m [b]
202     forM_ :: (Monad m) => [a] -> (a -> m b) -> m ()
203
204 So we can write:
205
206     Prelude Control.Monad> forM_ [1..4] \$ \x -> print x
207     1
208     2
209     3
210     4
211
212]
213[Hide internal module from haddock in Data.ByteString
214Don Stewart <dons@cse.unsw.edu.au>**20060828011515]
216Ross Paterson <ross@soi.city.ac.uk>**20060827170407]
217[expand advice on importing these modules
218Ross Paterson <ross@soi.city.ac.uk>**20060827164044]
220Ross Paterson <ross@soi.city.ac.uk>**20060827115140]
221[Clarify how one hides Prelude.catch
222Don Stewart <dons@cse.unsw.edu.au>**20060826124346
223
224 User feedback indicated that an example was required, of how to hide
225 Prelude.catch, so add such an example to the docs
226
227]
228[Workaround for OSes that don't have intmax_t and uintmax_t
229Ian Lynagh <igloo@earth.li>**20060825134936
230 OpenBSD (and possibly others) do not have intmax_t and uintmax_t types:
232 so substitute (unsigned) long long if we have them, otherwise
233 (unsigned) long.
234
235]
237Simon Marlow <simonmar@microsoft.com>**20060825110610]
238[document minimal complete definition for Bits
239Ross Paterson <ross@soi.city.ac.uk>**20060824140504]
240[C regex library bits have moved to the regex-posix package
241Simon Marlow <simonmar@microsoft.com>**20060824132311]
242[Add shared Typeable support (ghc only)
243Esa Ilari Vuokko <ei@vuokko.info>**20060823003126]
244[this should have been removed with the previous patch
245Simon Marlow <simonmar@microsoft.com>**20060824121223]
246[remove Text.Regx & Text.Regex.Posix
247Simon Marlow <simonmar@microsoft.com>**20060824094615
248 These are subsumed by the new regex-base, regex-posix and regex-compat
249 packages.
250]
251[explicitly tag Data.ByteString rules with the FPS prefix.
252Don Stewart <dons@cse.unsw.edu.au>**20060824041326]
253[Add spec rules for sections in Data.ByteString
254Don Stewart <dons@cse.unsw.edu.au>**20060824012611]
255[Sync Data.ByteString with current stable branch, 0.7
256Don Stewart <dons@cse.unsw.edu.au>**20060823143338]
258Simon Marlow <simonmar@microsoft.com>**20060823095059]
259[copyFile: try removing the target file before opening it for writing
260Simon Marlow <simonmar@microsoft.com>*-20060822121909]
261[copyFile: try removing the target file before opening it for writing
262Simon Marlow <simonmar@microsoft.com>**20060822121909]
263[add alternative functors and extra instances
264Ross Paterson <ross@soi.city.ac.uk>**20060821152151
265
266 * Alternative class, for functors with a monoid
267 * instances for Const
268 * instances for arrows
269]
270[generate Haddock docs on all platforms
271Simon Marlow <simonmar@microsoft.com>**20060821131612]
272[remove extra comma from import
273Ross Paterson <ross@soi.city.ac.uk>**20060819173954]
274[fix docs for withC(A)StringLen
275Ross Paterson <ross@soi.city.ac.uk>**20060818170328]
276[use Haskell'98 compliant indentation in do blocks
277Malcolm.Wallace@cs.york.ac.uk**20060818130810]
278[use correct names of IOArray operations for nhc98
279Malcolm.Wallace@cs.york.ac.uk**20060818130714]
280[add mapMaybe and mapEither, plus WithKey variants
281Ross Paterson <ross@soi.city.ac.uk>**20060817235041]
282[remove Text.Html from nhc98 build
283Malcolm.Wallace@cs.york.ac.uk**20060817135502]
284[eliminate more HOST_OS tests
285Ross Paterson <ross@soi.city.ac.uk>**20060815190609]
286[Hugs only: disable unused process primitives
287Ross Paterson <ross@soi.city.ac.uk>**20060813184435
288
289 These were the cause of Hugs bug #30, I think, and weren't used by Hugs anyway.
290]
291[markup fix to Data.HashTable
292Ross Paterson <ross@soi.city.ac.uk>**20060812103835]
293[revert removal of ghcconfig.h from package.conf.in
294Ross Paterson <ross@soi.city.ac.uk>**20060812082702
295
296 as it's preprocessed with -undef (pointed out by Esa Ilari Vuokko)
297]
298[fix Data.HashTable for non-GHC
299Ross Paterson <ross@soi.city.ac.uk>**20060811231521]
300[remove deprecated 'withObject'
301Simon Marlow <simonmar@microsoft.com>**20060811152350]
302[Jan-Willem Maessen's improved implementation of Data.HashTable
303Simon Marlow <simonmar@microsoft.com>**20060811151024
304 Rather than incrementally enlarging the hash table, this version
305 just does it in one go when the table gets too full.
306]
307[Warning police: Make some prototypes from the RTS known
308sven.panne@aedion.de**20060811144629]
309[Warning police: Removed useless catch-all clause
310sven.panne@aedion.de**20060811142208]
311[reduce dependency on ghcconfig.h
312Ross Paterson <ross@soi.city.ac.uk>**20060811124030
313
314 The only remaining use is in cbits/dirUtils.h, which tests solaris2_HOST_OS
315
316 (Also System.Info uses ghcplatform.h and several modules import MachDeps.h
317 to get SIZEOF_* and ALIGNMENT_* from ghcautoconf.h)
318]
319[(non-GHC only) track MArray interface change
320Ross Paterson <ross@soi.city.ac.uk>**20060810182902]
321[move Text.Html to a separate package
322Simon Marlow <simonmar@microsoft.com>**20060810113017]
323[bump version to 2.0
324Simon Marlow <simonmar@microsoft.com>**20060810112833]
325[Remove deprecated Data.FiniteMap and Data.Set interfaces
326Simon Marlow <simonmar@microsoft.com>**20060809153810]
327[move altzone test from ghc to base package
328Ross Paterson <ross@soi.city.ac.uk>**20060809124259]
329[remove unnecessary #include "ghcconfig.h"
330Ross Paterson <ross@soi.city.ac.uk>**20060809123812]
331[Change the API of MArray to allow resizable arrays
332Simon Marlow <simonmar@microsoft.com>**20060809100548
333 See #704
334
335 The MArray class doesn't currently allow a mutable array to change its
336 size, because of the pure function
337
338   bounds :: (HasBounds a, Ix i) => a i e -> (i,i)
339
340 This patch removes the HasBounds class, and adds
341
342   getBounds :: (MArray a e m, Ix i) => a i e -> m (i,i)
343
344 to the MArray class, and
345
346   bounds :: (IArray a e, Ix i) => a i e -> (i,i)
347
348 to the IArray class.
349
350 The reason that bounds had to be incorporated into the IArray class is
351 because I couldn't make DiffArray work without doing this.  DiffArray
352 acts as a layer converting an MArray into an IArray, and there was no
353 way (that I could find) to define an instance of HasBounds for
354 DiffArray.
355]
356[deprecate this module.
357Simon Marlow <simonmar@microsoft.com>**20060808100708]
359Simon Marlow <simonmar@microsoft.com>**20060807155545]
360[remove spurious 'extern "C" {'
361Simon Marlow <simonmar@microsoft.com>**20060724160258]
362[Fix unsafeIndex for large ranges
363Simon Marlow <simonmar@microsoft.com>**20060721100225]
364[disambiguate uses of foldr for nhc98 to compile without errors
365Malcolm.Wallace@cs.york.ac.uk**20060711161614]
367Malcolm.Wallace@cs.york.ac.uk**20060711160941]
368[breakpointCond
369Lemmih <lemmih@gmail.com>**20060708055528]
370[UNDO: Merge "unrecognized long opt" fix from 6.4.2
371Simon Marlow <simonmar@microsoft.com>**20060705142537
372 This patch undid the previous patch, "RequireOrder: do not collect
373 unrecognised options after a non-opt".  I asked Sven to revert it, but
375
376 See bug #473.
377]
378[Avoid strictness in accumulator for unpackFoldr
379Don Stewart <dons@cse.unsw.edu.au>**20060703091806
380
381 The seq on the accumulator for unpackFoldr will break in the presence of
382 head/build rewrite rules. The empty list case will be forced, producing
383 an exception. This is a known issue with seq and rewrite rules that we
384 just stumbled on to.
385
386]
387[Disable unpack/build fusion
388Don Stewart <dons@cse.unsw.edu.au>**20060702083913
389
390 unpack/build on bytestrings seems to trigger a bug when interacting with
391 head/build fusion in GHC.List. The bytestring001 testcase catches it.
392
393 I'll investigate further, but best to disable this for now (its not
394 often used anyway).
395
396 Note that with -frules-off or ghc 6.4.2 things are fine. It seems to
397 have emerged with the recent rules changes.
398
399]
400[Import Data.ByteString.Lazy, improve ByteString Fusion, and resync with FPS head
401Don Stewart <dons@cse.unsw.edu.au>**20060701084345
402
403 This patch imports the Data.ByteString.Lazy module, and its helpers,
404 providing a ByteString implemented as a lazy list of strict cache-sized
405 chunks. This type allows the usual lazy operations to be written on
406 bytestrings, including lazy IO, with much improved space and time over
407 the [Char] equivalents.
408
409]
410[Wibble in docs for new ForeignPtr functionsn
411Don Stewart <dons@cse.unsw.edu.au>**20060609075924]
413Ross Paterson <ross@soi.city.ac.uk>**20060622170436]
414[default to NoBuffering on Windows for a read/write text file
415Simon Marlow <simonmar@microsoft.com>**20060622144446
416 Fixes (works around) #679
417]
419Simon Marlow <simonmar@microsoft.com>**20060622144433]
420[clarify and expand docs
421Simon Marlow <simonmar@microsoft.com>**20060622112911]
422[Add minView and maxView to Map and Set
423jeanphilippe.bernardy@gmail.com**20060616180121]
425Ross Paterson <ross@soi.city.ac.uk>**20060614114456]
427Ross Paterson <ross@soi.city.ac.uk>**20060613142704]
428[Optimised foreign pointer representation, for heap-allocated objects
429Don Stewart <dons@cse.unsw.edu.au>**20060608015011]
431simonpj@microsoft.com**20060605115814
432
433 This commit adds the 'inline' function described in the
434 related patch in the compiler.
435
437
438]
439[small intro to exceptions
440Ross Paterson <ross@soi.city.ac.uk>**20060525111604]
441[export breakpoint
442Simon Marlow <simonmar@microsoft.com>**20060525090456]
443[Merge in changes from fps head. Highlights:
444Don Stewart <dons@cse.unsw.edu.au>**20060525065012
445
446     Wed May 24 15:49:38 EST 2006  sjanssen@cse.unl.edu
447       * instance Monoid ByteString
448
449     Wed May 24 15:04:04 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
450       * Rearange export lists for the .Char8 modules
451
452     Wed May 24 14:59:56 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
453       * Implement mapAccumL and reimplement mapIndexed using loopU
454
455     Wed May 24 14:47:32 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
456       * Change the implementation of the unfoldr(N) functions.
457       Use a more compact implementation for unfoldrN and change it's behaviour
458       to only return Just in the case that it actually 'overflowed' the N, so
459       the boundary case of unfolding exactly N gives Nothing.
460       Implement unfoldr and Lazy.unfoldr in terms of unfoldrN. Use fibonacci
461       growth for the chunk size in unfoldr
462
463     Wed May 24 08:32:29 EST 2006  sjanssen@cse.unl.edu
464       * Add unfoldr to ByteString and .Char8
465       A preliminary implementation of unfoldr.
466
467     Wed May 24 01:39:41 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
468       * Reorder the export lists to better match the Data.List api
469
470     Tue May 23 14:04:32 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
471       * pack{Byte,Char} -> singleton. As per fptools convention
472
473     Tue May 23 14:00:51 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
474       * elemIndexLast -> elemIndexEnd
475
476     Tue May 23 13:57:34 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
477       * In the search for a more orthogonal api, we kill breakFirst/breakLast,
478         which were of dubious value
479
480     Tue May 23 12:24:09 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
481       * Abolish elems. It's name implied it was unpack, but its type didn't. it made no sense
482
483     Tue May 23 10:42:09 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
484       * Minor doc tidyup. Use haddock markup better.
485
486     Tue May 23 11:00:31 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
487       * Simplify the join() implementation. Spotted by Duncan.
488
489]
491Simon Marlow <simonmar@microsoft.com>**20060524121823]
492[Sync with FPS head, including the following patches:
493Don Stewart <dons@cse.unsw.edu.au>**20060520030436
494
495     Thu May 18 15:45:46 EST 2006  sjanssen@cse.unl.edu
496       * Export unsafeTake and unsafeDrop
497
498     Fri May 19 11:53:08 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
500
501     Fri May 19 13:41:24 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
502       * Add fuseable scanl, scanl1 + properties
503
504     Fri May 19 18:20:40 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
505       * Spotted another chance to use unsafeTake,Drop (in groupBy)
506
507     Thu May 18 09:24:25 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
508       * More effecient findIndexOrEnd based on the impl of findIndex
509
510     Thu May 18 09:22:49 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
511       * Eliminate special case in findIndex since it's handled anyway.
512
513     Thu May 18 09:19:08 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
514       * Add unsafeTake and unsafeDrop
515       These versions assume the n is in the bounds of the bytestring, saving
516       two comparison tests. Then use them in varous places where we think this
517       holds. These cases need double checking (and there are a few remaining
518       internal uses of take / drop that might be possible to convert).
519       Not exported for the moment.
520
521     Tue May 16 23:15:11 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
522       * Handle n < 0 in drop and splitAt. Spotted by QC.
523
524     Tue May 16 22:46:22 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
525       * Handle n <= 0 cases for unfoldr and replicate. Spotted by QC
526
527     Tue May 16 21:34:11 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
528       * mapF -> map', filterF -> filter'
529
530]
532Ross Paterson <ross@soi.city.ac.uk>**20060518154723]
533[simplify indexing in Data.Sequence
534Ross Paterson <ross@soi.city.ac.uk>**20060518154316]
535[Move Eq, Ord, Show instances for ThreadId to GHC.Conc
536Simon Marlow <simonmar@microsoft.com>**20060518113339
537 Eliminates orphans.
538]
539[Better error handling in the IO manager thread
540Simon Marlow <simonmar@microsoft.com>**20060518113303
541 In particular, handle EBADF just like rts/posix/Select.c, by waking up
542 all the waiting threads.  Other errors are thrown, instead of just
543 being ignored.
544]
545[#define _REENTRANT 1  (needed to get the right errno on some OSs)
546Simon Marlow <simonmar@microsoft.com>**20060518104151
547 Part 2 of the fix for threaded RTS problems on Solaris and possibly
548 *BSD (Part 1 was the same change in ghc/includes/Rts.h).
549]
550[copyCString* should be in IO. Spotted by Tomasz Zielonka
551Don Stewart <dons@cse.unsw.edu.au>**20060518012154]
552[add import Prelude to get dependencies right for Data/Fixed.hs
553Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060517222044
554 Hopefully this fixes parallel builds.
555]
556[Fix negative index handling in splitAt, replicate and unfoldrN. Move mapF, filterF -> map', filter' while we're here
557Don Stewart <dons@cse.unsw.edu.au>**20060517020150]
558[Use our own realloc. Thus reduction functions (like filter) allocate on the Haskell heap. Makes around 10% difference.
559Don Stewart <dons@cse.unsw.edu.au>**20060513051736]
560[Last two CInt fixes for 64 bit, and bracket writeFile while we're here
561Don Stewart <dons@cse.unsw.edu.au>**20060512050750]
562[Some small optimisations, generalise the type of unfold
563Don Stewart <dons@cse.unsw.edu.au>**20060510043309
564
565     Tue May  9 22:36:29 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
566       * Surely the error function should not be inlined.
567
568     Tue May  9 22:35:53 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
569       * Reorder memory writes for better cache locality.
570
571     Tue May  9 23:28:09 EST 2006  Duncan Coutts <duncan.coutts@worc.ox.ac.uk>
572       * Generalise the type of unfoldrN
573
574       The type of unfoldrN was overly constrained:
575       unfoldrN :: Int -> (Word8 -> Maybe (Word8, Word8)) -> Word8 -> ByteString
576
577       if we compare that to unfoldr:
578       unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
579
580       So we can generalise unfoldrN to this type:
581       unfoldrN :: Int -> (a -> Maybe (Word8, a)) -> a -> ByteString
582
583       and something similar for the .Char8 version. If people really do want to
584       use it a lot with Word8/Char then perhaps we should add a specialise pragma.
585
586     Wed May 10 13:26:40 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
587       * Add foldl', and thus a fusion rule for length . {map,filter,fold},
588       that avoids creating an array at all if the end of the pipeline is a 'length' reduction
589
590 **END OF DESCRIPTION***
591
592 Place the long patch description above the ***END OF DESCRIPTION*** marker.
593 The first line of this file will be the patch name.
594
595
596 This patch contains the following changes:
597
598 M ./Data/ByteString.hs -8 +38
599 M ./Data/ByteString/Char8.hs -6 +12
600]
601[portable implementation of WordPtr/IntPtr for non-GHC
602Ross Paterson <ross@soi.city.ac.uk>**20060510001826
603
604 plus much tweaking of imports to avoid cycles
605]
606[add WordPtr and IntPtr types to Foreign.Ptr, with associated conversions
607Simon Marlow <simonmar@microsoft.com>**20060509092606
608
609 As suggested by John Meacham.
610
611 I had to move the Show instance for Ptr into GHC.ForeignPtr to avoid
612 recursive dependencies.
613]
614[add CIntPtr, CUIntPtr, CIntMax, CUIntMax types
615Simon Marlow <simonmar@microsoft.com>**20060509092427]
617Simon Marlow <simonmar@microsoft.com>**20060509082739]
618[Two things. #if defined(__GLASGOW_HASKELL__) on INLINE [n] pragmas (for jhc). And careful use of INLINE on words/unwords halves runtime for those functions
619Don Stewart <dons@cse.unsw.edu.au>**20060509023425]
620[Make length a good consumer
621simonpj@microsoft**20060508142726
622
623 Make length into a good consumer.  Fixes Trac bug #707.
624
625 (Before length simply didn't use foldr.)
626
627]
628[Trim imports
629simonpj@microsoft**20060508142557]
630[Make unsafePerformIO lazy
631simonpj@microsoft**20060508142507
632
633 The stricteness analyser used to have a HACK which ensured that NOINLNE things
634 were not strictness-analysed.  The reason was unsafePerformIO. Left to itself,
635 the strictness analyser would discover this strictness for unsafePerformIO:
636        unsafePerformIO:  C(U(AV))
637 But then consider this sub-expression
638        unsafePerformIO (\s -> let r = f x in
639                               case writeIORef v r s of (# s1, _ #) ->
640                               (# s1, r #)
641 The strictness analyser will now find that r is sure to be eval'd,
642 and may then hoist it out.  This makes tests/lib/should_run/memo002
644
645 Solving this by making all NOINLINE things have no strictness info is overkill.
646 In particular, it's overkill for runST, which is perfectly respectable.
647 Consider
648        f x = runST (return x)
649 This should be strict in x.
650
651 So the new plan is to define unsafePerformIO using the 'lazy' combinator:
652
653        unsafePerformIO (IO m) = lazy (case m realWorld# of (# _, r #) -> r)
654
655 Remember, 'lazy' is a wired-in identity-function Id, of type a->a, which is
656 magically NON-STRICT, and is inlined after strictness analysis.  So
657 unsafePerformIO will look non-strict, and that's what we want.
658
659]
661Don Stewart <dons@cse.unsw.edu.au>**20060508122322
662
663 Mon May  8 10:40:14 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
664   * Fix all uses for Int that should be CInt or CSize in ffi imports.
665   Spotted by Igloo, dcoutts
666
667 Mon May  8 16:09:41 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
668   * Import nicer loop/loop fusion rule from ghc-ndp
669
670 Mon May  8 17:36:07 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
671   * Fix stack leak in split on > 60M strings
672
673 Mon May  8 17:50:13 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
674   * Try same fix for stack overflow in elemIndices
675
676]
677[Fix all uses for Int that should be CInt or CSize in ffi imports. Spotted by Duncan and Ian
678Don Stewart <dons@cse.unsw.edu.au>**20060508010311]
679[Fixed import list syntax
680Sven Panne <sven.panne@aedion.de>**20060507155008]
681[Faster filterF, filterNotByte
682dons@cse.unsw.edu.au**20060507042301]
683[Much faster find, findIndex. Hint from sjanssen
684dons@cse.unsw.edu.au**20060507033048]
685[Merge "unrecognized long opt" fix from 6.4.2
686Sven Panne <sven.panne@aedion.de>**20060506110519]
687[
688dons@cse.unsw.edu.au**20060506061029
689 Sat May  6 13:01:34 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
690   * Do loopU realloc on the Haskell heap. And add a really tough stress test
691
692 Sat May  6 12:28:58 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
693   * Use simple, 3x faster concat. Plus QC properties. Suggested by sjanssen and dcoutts
694
695 Sat May  6 15:59:31 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
696   * dcoutt's packByte bug squashed
697
698   With inlinePerformIO, ghc head was compiling:
699
700    packByte 255 `compare` packByte 127
701
702   into roughly
703
704    case mallocByteString 2 of
705        ForeignPtr f internals ->
706             case writeWord8OffAddr# f 0 255 of _ ->
707             case writeWord8OffAddr# f 0 127 of _ ->
708             case eqAddr# f f of
709                    False -> case compare (GHC.Prim.plusAddr# f 0)
711
712   which is rather stunning. unsafePerformIO seems to prevent whatever
714
715]
716[Add array fusion versions of map, filter and foldl
717dons@cse.unsw.edu.au**20060505060858
718
719 This patch adds fusable map, filter and foldl, using the array fusion
720 code for unlifted, flat arrays, from the Data Parallel Haskell branch,
721 after kind help from Roman Leshchinskiy,
722
723 Pipelines of maps, filters and folds should now need to walk the
724 bytestring once only, and intermediate bytestrings won't be constructed.
725
726]
727[fix for non-GHC
728Ross Paterson <ross@soi.city.ac.uk>**20060504093044]
729[use bracket in appendFile (like writeFile)
730Ross Paterson <ross@soi.city.ac.uk>**20060504091528]
731[writeFile: close the file on error
732Simon Marlow <simonmar@microsoft.com>**20060504084505
733 Suggested by Ross Paterson, via Neil Mitchell
734
735]
737dons@cse.unsw.edu.au**20060503105259
738
739 This patch brings Data.ByteString into sync with the FPS head.
740 The most significant of which is the new Haskell counting sort.
741
742 Changes:
743
744 Sun Apr 30 18:16:29 EST 2006  sjanssen@cse.unl.edu
745   * Fix foldr1 in Data.ByteString and Data.ByteString.Char8
746
747 Mon May  1 11:51:16 EST 2006  Don Stewart <dons@cse.unsw.edu.au>
748   * Add group and groupBy. Suggested by conversation between sjanssen and petekaz on #haskell
749
750 Mon May  1 16:42:04 EST 2006  sjanssen@cse.unl.edu
751   * Fix groupBy to match Data.List.groupBy.
752
753 Wed May  3 15:01:07 EST 2006  sjanssen@cse.unl.edu
754   * Migrate to counting sort.
755
756   Data.ByteString.sort used C's qsort(), which is O(n log n).  The new algorithm
757   is O(n), and is faster for strings larger than approximately thirty bytes.  We
758   also reduce our dependency on cbits!
759
760]
761[improve performance of Integer->String conversion
762Simon Marlow <simonmar@microsoft.com>**20060503113306
763 See
765
767
768
769]
770[inline withMVar, modifyMVar, modifyMVar_
771Simon Marlow <simonmar@microsoft.com>**20060503111152]
772[Fix string truncating in hGetLine -- it was a pasto from Simon's code
773Simon Marlow <simonmar@microsoft.com>**20060503103504
774 (from Don Stewart)
775]
776[Merge in Data.ByteString head. Fixes ByteString+cbits in hugs
777Don Stewart <dons@cse.unsw.edu.au>**20060429040733]
778[Import Data.ByteString from fps 0.5.
779Don Stewart <dons@cse.unsw.edu.au>**20060428130718
780 Fast, packed byte vectors, providing a better PackedString.
781
782]
783[fix previous patch
784Ross Paterson <ross@soi.city.ac.uk>**20060501154847]
785[fixes for non-GHC
786Ross Paterson <ross@soi.city.ac.uk>**20060501144322]
787[fix imports for mingw32 && !GHC
788Ross Paterson <ross@soi.city.ac.uk>**20060427163248]
789[RequireOrder: do not collect unrecognised options after a non-opt
790Simon Marlow <simonmar@microsoft.com>**20060426121110
791 The documentation for RequireOrder says "no option processing after
792 first non-option", so it doesn't seem right that we should process the
793 rest of the arguments to collect the unrecognised ones.  Presumably
794 the client wants to know about the unrecognised options up to the
795 first non-option, and will be using a different option parser for the
796 rest of the command line.
797
798 eg. before:
799
800 Prelude System.Console.GetOpt> getOpt' RequireOrder [] ["bar","--foo"]
801 ([],["bar","--foo"],["--foo"],[])
802
803 after:
804
805 Prelude System.Console.GetOpt> getOpt' RequireOrder [] ["bar","--foo"]
806 ([],["bar","--foo"],[],[])
807]
809Ashley Yakeley <ashley@semantic.org>**20060426072521]
811Ashley Yakeley <ashley@semantic.org>**20060425071853]
813Ross Paterson <ross@soi.city.ac.uk>**20060424102146]
814[add superclasses to Applicative and Traversable
815Ross Paterson <ross@soi.city.ac.uk>**20060411144734
816
817 Functor is now a superclass of Applicative, and Functor and Foldable
818 are now superclasses of Traversable.  The new hierarchy makes clear the
819 inclusions between the classes, but means more work in defining instances.
820 Default definitions are provided to help.
821]
823Ross Paterson <ross@soi.city.ac.uk>**20060410111443]
824[GHC.Base.breakpoint
825Lemmih <lemmih@gmail.com>**20060407125827]
826[Track the GHC source tree reorganisation
827Simon Marlow <simonmar@microsoft.com>**20060407041631]
828[in the show instance for Exception, print the type of dynamic exceptions
829Simon Marlow <simonmar@microsoft.com>**20060406112444
830 Unfortunately this requires some recursve module hackery to get at
831 the show instance for Typeable.
832]
833[implement ForeignEnvPtr, newForeignPtrEnv, addForeignPtrEnv for GHC
834Simon Marlow <simonmar@microsoft.com>**20060405155448]
836Simon Marlow <simonmar@microsoft.com>**20060327135018]
837[Rework previous: not a gcc bug after all
838Simon Marlow <simonmar@microsoft.com>**20060323161229
839 It turns out that we were relying on behaviour that is undefined in C,
840 and undefined behaviour in C means "the compiler can do whatever the
841 hell it likes with your entire program".  So avoid that.
842]
843[work around a gcc 4.1.0 codegen bug in -O2 by forcing -O1 for GHC.Show
844Simon Marlow <simonmar@microsoft.com>**20060323134514
845 See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26824
846]
847[commit mysteriously missing parts of "runIOFastExit" patch
848Simon Marlow <simonmar@microsoft.com>**20060321101535]
849[add runIOFastExit :: IO a -> IO a
850Simon Marlow <simonmar@microsoft.com>**20060320124333
851 Similar to runIO, but calls stg_exit() directly to exit, rather than
852 shutdownHaskellAndExit().  Needed for running GHCi in the test suite.
853]
854[Fix a broken invariant
855Simon Marlow <simonmar@microsoft.com>**20060316134151
856 Patch from #694,  for the problem "empty is an identity for <> and \$\$" is
857 currently broken by eg. isEmpty (empty<>empty)"
858]
859[Add unsafeSTToIO :: ST s a -> IO a
860Simon Marlow <simonmar@microsoft.com>**20060315160232
861 Implementation for Hugs is missing, but should be easy.  We need this
862 for the forthcoming nested data parallelism implementation.
863]
865jeanphilippe.bernardy@gmail.com**20060315143539
866 Added 'alter :: (Maybe a -> Maybe a) -> k -> Map k a -> Map k a' to IntMap and Map
868]
869[deprecate FunctorM in favour of Foldable and Traversable
870Ross Paterson <ross@soi.city.ac.uk>**20060315092942
871 as discussed on the libraries list.
872]
873[Simplify Eq, Ord, and Show instances for UArray
874Simon Marlow <simonmar@microsoft.com>**20060313142701
875 The Eq, Ord, and Show instances of UArray were written out longhand
876 with one instance per element type.  It is possible to condense these
877 into a single instance for each class, at the expense of using more
878 extensions (non-std context on instance declaration).
879
880 Suggestion by: Frederik Eaton <frederik@ofb.net>
881
882]
883[Oops typo in intSet notMember
884jeanphilippe.bernardy@gmail.com**20060311224713]
886jeanphilippe.bernardy@gmail.com**20060311224502]
887[Added notMember to Data.IntSet and Data.IntMap
888jeanphilippe.bernardy@gmail.com**20060311085221]
890John Meacham <john@repetae.net>**20060309191806]
892Simon Marlow <simonmar@microsoft.com>**20060310114532
893 fixes #588
894]
895[make head/build rule apply to all types, not just Bool.
896John Meacham <john@repetae.net>**20060303045753]
897[Avoid overflow when normalising clock times
898Ian Lynagh <igloo@earth.li>**20060210144638]
899[Years have 365 days, not 30*365
900Ian Lynagh <igloo@earth.li>**20060210142853]
901[declare blkcmp() static
902Simon Marlow <simonmar@microsoft.com>**20060223134317]
903[typo in comment in Foldable class
904Ross Paterson <ross@soi.city.ac.uk>**20060209004901]
905[simplify fmap
906Ross Paterson <ross@soi.city.ac.uk>**20060206095048]
907[update ref in comment
908Ross Paterson <ross@soi.city.ac.uk>**20060206095139]
909[Give -foverlapping-instances to Data.Typeable
910simonpj@microsoft**20060206133439
911
912 For some time, GHC has made -fallow-overlapping-instances "sticky":
913 any instance in a module compiled with -fallow-overlapping-instances
914 can overlap when imported, regardless of whether the importing module
915 allows overlap.  (If there is an overlap, both instances must come from
916 modules thus compiled.)
917
918 Instances in Data.Typeable might well want to be overlapped, so this
919 commit adds the flag to Data.Typeable (with an explanatory comment)
920
921
922]
923[Add -fno-bang-patterns to modules using both bang and glasgow-exts
924simonpj@microsoft.com**20060203175759]
925[When splitting a bucket, keep the contents in the same order
926Simon Marlow <simonmar@microsoft.com>**20060201130427
927 To retain the property that multiple inserts shadow each other
928 (see ticket #661, test hash001)
929]
930[add foldr/build optimisation for take and replicate
931Simon Marlow <simonmar@microsoft.com>**20060126164603
932 This allows take to be deforested, and improves performance of
933 replicate and replicateM/replicateM_.  We have a separate problem that
934 means expressions involving [n..m] aren't being completely optimised
935 because eftIntFB isn't being inlined but otherwise the results look
936 good.
937
938 Sadly this has invalidated a number of the nofib benchmarks which were
939 erroneously using take to duplicate work in a misguided attempt to
940 lengthen their runtimes (ToDo).
941]
943Simon Marlow <simonmar@microsoft.com>**20060124131121
944 Patch originally from Dinko Tenev <dinko.tenev@gmail.com>, modified
945 to add log message by me.
946]
947[[project @ 2006-01-19 14:47:15 by ross]
948ross**20060119144715
949 backport warning avoidance from Haddock
950]
951[[project @ 2006-01-18 11:45:47 by malcolm]
952malcolm**20060118114547
953 Fix import of Ix for nhc98.
954]
955[[project @ 2006-01-17 09:38:38 by ross]
956ross**20060117093838
957 add Ix instance for GeneralCategory.
958]
959[TAG Initial conversion from CVS complete
960John Goerzen <jgoerzen@complete.org>**20060112154126]
961Patch bundle hash:
962879b89a48e2b1239c50a8755fc38eea8e352f971