Ticket #1990: subsequences-permutations.patch

File subsequences-permutations.patch, 7.3 KB (added by twanvl, 5 years ago)

darcs patch

Line 
1
2New patches:
3
4[Add 'subsequences' and 'permutations' to Data.List
5Twan van Laarhoven <twanvl@gmail.com>**20071218154950] {
6hunk ./Data/List.hs 40
7+   
8+   , subsequences      -- :: [a] -> [[a]]
9+   , permutations      -- :: [a] -> [[a]]
10hunk ./Data/List.hs 736
11+
12+-- | The 'subsequences' function returns the list of all subsequences of the argument.
13+--
14+-- > subsequences "abc" == ["","c","b","bc","a","ac","ab","abc"]
15+subsequences            :: [a] -> [[a]]
16+subsequences []         =  [[]]
17+subsequences (x:xs)     =  subsequences xs ++ map (x:) (subsequences xs)
18+
19+-- | The 'permutations' function returns the list of all permutations of the argument.
20+--
21+-- > permutations "abc" == ["abc","bac","bca","acb","cab","cba"]
22+permutations            :: [a] -> [[a]]
23+permutations []         =  [[]]
24+permutations (x:xs)     =  [zs | ys <- permutations xs, zs <- interleave x ys ]
25+  where interleave          :: a -> [a] -> [[a]]
26+        interleave x []     =  [[x]]
27+        interleave x (y:ys) =  [x:y:ys] ++ map (y:) (interleave x ys)
28+
29}
30
31Context:
32
33[Add GHC.Prim to exposedModules in the Haddock 0.x hook
34David Waern <david.waern@gmail.com>*-20071209173931
35 
36 Please merge to the stable branch
37]
38[Add GHC.Prim to exposedModules in the Haddock 0.x hook
39David Waern <david.waern@gmail.com>**20071209173931
40 
41 Please merge to the stable branch
42]
43[Simplify the GHC.Prim hack in base.cabal/Setup.hs
44Ian Lynagh <igloo@earth.li>**20071202215758]
45[Implement 'openTempFile' for nhc98.
46Malcolm.Wallace@cs.york.ac.uk**20071207133335]
47[docs: describe the changes to forkIO, and document forkOnIO
48Simon Marlow <simonmar@microsoft.com>**20071205091423]
49[doc only: use realToFrac instead of fromRational.toRational
50Simon Marlow <simonmar@microsoft.com>**20071205091334]
51[Add singletonP to GHC.PArr
52Roman Leshchinskiy <rl@cse.unsw.edu.au>**20071205220859]
53[FIX #1621: bug in Windows code for getCPUTime
54Simon Marlow <simonmar@microsoft.com>**20071205120118
55 We were reading the components of FILETIME as CLong, when they should
56 be unsigned.  Word32 seems to be the correct type here.
57]
58[protect console handler against concurrent access (#1922)
59Simon Marlow <simonmar@microsoft.com>**20071204153940]
60[protect against concurrent access to the signal handlers (#1922)
61Simon Marlow <simonmar@microsoft.com>**20071204110817]
62[restore fdToHandle' to avoid breaking clients (#1109)
63Simon Marlow <simonmar@microsoft.com>**20071130135122
64 
65]
66[note about how to convert CTime (aka EpochTime) to UTCTime
67Simon Marlow <simonmar@microsoft.com>**20071130101648]
68[Fix some URLs
69Ian Lynagh <igloo@earth.li>**20071126214213]
70[Fix some links in haddock docs
71Ian Lynagh <igloo@earth.li>**20071126184428]
72[Don't try to make haddock links to the mtl package as we don't depend on it
73Ian Lynagh <igloo@earth.li>**20071126170631]
74[Escape some special characters in haddock docs
75Ian Lynagh <igloo@earth.li>**20071126163443]
76[FIX BUILD: maybeUpdateFile: ignore failures when removing the target
77Simon Marlow <simonmar@microsoft.com>**20071123092219]
78[FIX #1753
79Simon Marlow <simonmar@microsoft.com>**20071122094207
80 hClose should close the Handle and unlock the file even if calling
81 close() fails for some reason.
82]
83[remove lockFile.h from install-includes
84Simon Marlow <simonmar@microsoft.com>**20071121102248]
85[oops, we forgot to export traceShow
86Simon Marlow <simonmar@microsoft.com>**20071121094300]
87[Fix compilation with GHC 6.2.x
88Simon Marlow <simonmar@microsoft.com>**20071121084341]
89[Move file locking into the RTS, fixing #629, #1109
90Simon Marlow <simonmar@microsoft.com>**20071120121053
91 File locking (of the Haskell 98 variety) was previously done using a
92 static table with linear search, which had two problems: the array had
93 a fixed size and was sometimes too small (#1109), and performance of
94 lockFile/unlockFile was suboptimal due to the linear search.
95 Also the algorithm failed to count readers as required by Haskell 98
96 (#629).
97 
98 Now it's done using a hash table (provided by the RTS).  Furthermore I
99 avoided the extra fstat() for every open file by passing the dev_t and
100 ino_t into lockFile.  This and the improvements to the locking
101 algorithm result in a healthy 20% or so performance increase for
102 opening/closing files (see openFile008 test).
103]
104[Only overwrite GHC/Prim.hs and GHC/Primopwrappers.hs if they change
105Simon Marlow <simonmar@microsoft.com>**20071120102042
106 This avoids make doing unnecessary work after 'setup makefile'.
107]
108[fix comment
109Simon Marlow <simonmar@microsoft.com>**20071116091227]
110[Fix ` characters in elem's haddock docs
111Ian Lynagh <igloo@earth.li>**20071110173052]
112[Filter out GHC.Prim also for the Haddock step
113David Waern <david.waern@gmail.com>**20071109000806
114 Please merge to the GHC 6.8.2 branch
115]
116[Add module of special magic GHC desugaring helper functions
117Simon Marlow <simonmar@microsoft.com>**20071102160054
118 Currently containing only one such helper: (>>>) for arrow desugaring
119]
120[add Control.Category to the nhc98 build
121Malcolm.Wallace@cs.york.ac.uk**20071030120459]
122[fix nhc98 build: need a qualified Prelude import
123Malcolm.Wallace@cs.york.ac.uk**20071030120410]
124[Fix performance regression: re-instate -funbox-strict-fields
125Simon Marlow <simonmar@microsoft.com>**20071029150730
126 Yikes!  While investigating the increase in code size with GHC 6.8
127 relative to 6.6, I noticed that in the transition to Cabal for the
128 libraries we lost -funbox-strict-fields, which is more or less
129 depended on by the IO library for performance.  I'm astonished that we
130 didn't notice this earlier!
131 
132 To reduce the chances of this happening again, I put
133 -funbox-strict-fields in the OPTIONS_GHC pragma of the modules that
134 need it.  {-# UNPACK #-} pragmas would be better, though.
135]
136[FIX BUILD: Haddock 1.x fails to parse (Prelude..)
137Simon Marlow <simonmar@microsoft.com>**20071029131921]
138[new Control.Category, ghc ticket #1773
139Ashley Yakeley <ashley@semantic.org>**20071029022526]
140[new Control.Compositor module
141Ashley Yakeley <ashley@semantic.org>**20071013074851
142 
143 The Compositor class is a superclass of Arrow.
144]
145[Fix doc building with Haddock 0.9
146Simon Marlow <simonmar@microsoft.com>**20071024090947
147 I was using a recent build here, which is more tolerant.
148]
149[FIX #1258: document that openTempFile is secure(ish)
150Simon Marlow <simonmar@microsoft.com>**20071023130928
151 Also change the mode from 0666 to 0600, which seems like a more
152 sensible value and matches what C's mkstemp() does.
153]
154[Clean up .cabal file a bit
155Duncan Coutts <duncan@haskell.org>**20071022132708
156 specify build-type and cabal-version >= 1.2
157 put extra-tmp-files in the right place
158 use os(windows) rather than os(mingw32)
159]
160[base in 6.8 and head branch should be version 3.0
161Don Stewart <dons@galois.com>**20071007150408]
162[FIX #1652: openTempFile should accept an empty string for the directory
163Simon Marlow <simonmar@microsoft.com>**20071018122345]
164[clean up duplicate code
165Simon Marlow <simonmar@microsoft.com>**20071017141311]
166[expose the value of +RTS -N as GHC.Conc.numCapabilities (see #1733)
167Simon Marlow <simonmar@microsoft.com>**20071009132042]
168[typo
169Simon Marlow <simonmar@microsoft.com>**20070917130703]
170[put extra-tmp-files field in the right place
171Simon Marlow <simonmar@microsoft.com>**20070914140812]
172[Add more entries to boring file
173Ian Lynagh <igloo@earth.li>**20070913210500]
174[Add a boring file
175Ian Lynagh <igloo@earth.li>**20070913204641]
176[TAG 2007-09-13
177Ian Lynagh <igloo@earth.li>**20070913215720]
178Patch bundle hash:
1792c6887838a41d119f6aedae4f884771440a09d35