| 1 | |
|---|
| 2 | New patches: |
|---|
| 3 | |
|---|
| 4 | [Free all memory when shutting down. XXX not implemented for Posix. |
|---|
| 5 | lennart.augustsson@credit-suisse.com**20060302210724] { |
|---|
| 6 | hunk ./ghc/rts/MBlock.c 302 |
|---|
| 7 | +void |
|---|
| 8 | +freeAllMBlocks(void) |
|---|
| 9 | +{ |
|---|
| 10 | + /* XXX Do something here */ |
|---|
| 11 | +} |
|---|
| 12 | + |
|---|
| 13 | hunk ./ghc/rts/MBlock.c 325 |
|---|
| 14 | -char* base_non_committed = (char*)0; |
|---|
| 15 | -char* end_non_committed = (char*)0; |
|---|
| 16 | +static char* base_non_committed = (char*)0; |
|---|
| 17 | +static char* end_non_committed = (char*)0; |
|---|
| 18 | + |
|---|
| 19 | +static void *membase; |
|---|
| 20 | hunk ./ghc/rts/MBlock.c 367 |
|---|
| 21 | + membase = base_non_committed; |
|---|
| 22 | hunk ./ghc/rts/MBlock.c 369 |
|---|
| 23 | - errorBelch("getMBlocks: VirtualAlloc failed with: %ld\n", GetLastError()); |
|---|
| 24 | - ret=(void*)-1; |
|---|
| 25 | + errorBelch("getMBlocks: VirtualAlloc MEM_RESERVE %lu failed with: %ld\n", size_reserved_pool, GetLastError()); |
|---|
| 26 | + ret=(void*)-1; |
|---|
| 27 | hunk ./ghc/rts/MBlock.c 392 |
|---|
| 28 | - debugBelch("getMBlocks: VirtualAlloc failed with: %ld\n", GetLastError()); |
|---|
| 29 | + debugBelch("getMBlocks: VirtualAlloc MEM_COMMIT %lu failed with: %ld\n", size, GetLastError()); |
|---|
| 30 | hunk ./ghc/rts/MBlock.c 417 |
|---|
| 31 | + |
|---|
| 32 | +void |
|---|
| 33 | +freeAllMBlocks(void) |
|---|
| 34 | +{ |
|---|
| 35 | + BOOL rc; |
|---|
| 36 | + |
|---|
| 37 | + rc = VirtualFree(membase, 0, MEM_RELEASE); |
|---|
| 38 | + |
|---|
| 39 | + if (rc == FALSE) { |
|---|
| 40 | + debugBelch("freeAllMBlocks: VirtualFree failed with: %ld\n", GetLastError()); |
|---|
| 41 | + } |
|---|
| 42 | +} |
|---|
| 43 | hunk ./ghc/rts/MBlock.h 16 |
|---|
| 44 | +extern void freeAllMBlocks(void); |
|---|
| 45 | hunk ./ghc/rts/Storage.c 269 |
|---|
| 46 | + freeAllMBlocks(); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | Context: |
|---|
| 50 | |
|---|
| 51 | [Disable the NCG if GhcUnregisterised=YES |
|---|
| 52 | Simon Marlow <simonmar@microsoft.com>**20060301165341 |
|---|
| 53 | The NCG cannot be used in an unregisterised compiler, so there's no |
|---|
| 54 | point in including it. |
|---|
| 55 | ] |
|---|
| 56 | [Undo patch Simplify-the-IdInfo-before-any-RHSs |
|---|
| 57 | simonpj@microsoft.com**20060301161423 |
|---|
| 58 | |
|---|
| 59 | Sadly the above patch wasn't right, because it fouls |
|---|
| 60 | up pre/postInlineUnconditionally. This patch puts |
|---|
| 61 | things back as they were functionally, but with slightly |
|---|
| 62 | tidied-up code. |
|---|
| 63 | |
|---|
| 64 | ] |
|---|
| 65 | [fix parse error |
|---|
| 66 | Simon Marlow <simonmar@microsoft.com>**20060301160701] |
|---|
| 67 | [fix compilation with older GHCs |
|---|
| 68 | Simon Marlow <simonmar@microsoft.com>**20060301140931] |
|---|
| 69 | [update docs w.r.t. dllMain() definition (EXTFUN is no more) |
|---|
| 70 | Simon Marlow <simonmar@microsoft.com>**20060301130736] |
|---|
| 71 | [add comments |
|---|
| 72 | Simon Marlow <simonmar@microsoft.com>**20060301132018] |
|---|
| 73 | [add ':set prompt' command |
|---|
| 74 | Simon Marlow <simonmar@microsoft.com>**20060301131948 |
|---|
| 75 | |
|---|
| 76 | contributed by Neil Mitchell <ndmitchell@gmail.com>, with docs by me. |
|---|
| 77 | ] |
|---|
| 78 | [Add support for Data.Char.generalCategory to libcompat |
|---|
| 79 | Simon Marlow <simonmar@microsoft.com>**20060301113536 |
|---|
| 80 | |
|---|
| 81 | this is so that the stage1 compiler has proper support for Unicode. |
|---|
| 82 | Should fix these errors: |
|---|
| 83 | |
|---|
| 84 | lexical error in string/character literal at character '\8759' |
|---|
| 85 | |
|---|
| 86 | when building the stage2 compiler. |
|---|
| 87 | ] |
|---|
| 88 | [takeMVar/putMVar were missing some write barriers when modifying a TSO |
|---|
| 89 | Simon Marlow <simonmar@microsoft.com>**20060228163724 |
|---|
| 90 | |
|---|
| 91 | This relates to the recent introduction of clean/dirty TSOs, and the |
|---|
| 92 | consqeuent write barriers required. We were missing some write |
|---|
| 93 | barriers in the takeMVar/putMVar family of primops, when performing |
|---|
| 94 | the take/put directly on another TSO. |
|---|
| 95 | |
|---|
| 96 | Fixes #705, and probably some test failures. |
|---|
| 97 | ] |
|---|
| 98 | [A better x86_64 register mapping, with more argument registers. |
|---|
| 99 | Simon Marlow <simonmar@microsoft.com>**20060228153640 |
|---|
| 100 | |
|---|
| 101 | Now that we can handle using C argument registers as global registers, |
|---|
| 102 | extend the x86_64 register mapping. We now have 5 integer argument |
|---|
| 103 | registers, 4 float, and 2 double (all caller-saves). This results in a |
|---|
| 104 | reasonable speedup on x86_64. |
|---|
| 105 | ] |
|---|
| 106 | [filter the messages generated by gcc |
|---|
| 107 | Simon Marlow <simonmar@microsoft.com>**20060228153134 |
|---|
| 108 | |
|---|
| 109 | Eliminate things like "warning: call-clobbered register used as global |
|---|
| 110 | register variable", which is an non-suppressible warning from gcc. |
|---|
| 111 | ] |
|---|
| 112 | [Allow C argument regs to be used as global regs (R1, R2, etc.) |
|---|
| 113 | Simon Marlow <simonmar@microsoft.com>**20060228152942 |
|---|
| 114 | |
|---|
| 115 | The problem here was that we generated C calls with expressions |
|---|
| 116 | involving R1 etc. as parameters. When some of the R registers are |
|---|
| 117 | also C argument registers, both GCC and the native code generator |
|---|
| 118 | generate incorrect code. The hacky workaround is to assign |
|---|
| 119 | problematic arguments to temporaries first; fortunately this works |
|---|
| 120 | with both GCC and the NCG, but we have to be careful not to undo this |
|---|
| 121 | with later optimisations (see changes to CmmOpt). |
|---|
| 122 | ] |
|---|
| 123 | [pass arguments to unknown function calls in registers |
|---|
| 124 | Simon Marlow <simonmar@microsoft.com>**20060228152524 |
|---|
| 125 | |
|---|
| 126 | We now have more stg_ap entry points: stg_ap_*_fast, which take |
|---|
| 127 | arguments in registers according to the platform calling convention. |
|---|
| 128 | This is faster if the function being called is evaluated and has the |
|---|
| 129 | right arity, which is the common case (see the eval/apply paper for |
|---|
| 130 | measurements). |
|---|
| 131 | |
|---|
| 132 | We still need the stg_ap_*_info entry points for stack-based |
|---|
| 133 | application, such as an overflows when a function is applied to too |
|---|
| 134 | many argumnets. The stg_ap_*_fast functions actually just check for |
|---|
| 135 | an evaluated function, and if they don't find one, push the args on |
|---|
| 136 | the stack and invoke stg_ap_*_info. (this might be slightly slower in |
|---|
| 137 | some cases, but not the common case). |
|---|
| 138 | ] |
|---|
| 139 | [fix live register annotations on foreign calls |
|---|
| 140 | Simon Marlow <simonmar@microsoft.com>**20060228151815 |
|---|
| 141 | |
|---|
| 142 | fix one incorrect case, and made several more accurate |
|---|
| 143 | ] |
|---|
| 144 | [ Simplify the IdInfo before any RHSs |
|---|
| 145 | simonpj@microsoft.com**20060228133157 |
|---|
| 146 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 147 | Simplfy (i.e. substitute) the IdInfo of a recursive group of Ids |
|---|
| 148 | before looking at the RHSs of *any* of them. That way, the rules |
|---|
| 149 | are available throughout the letrec, which means we don't have to |
|---|
| 150 | be careful about function to put first. |
|---|
| 151 | |
|---|
| 152 | Before, we just simplified the IdInfo of f before looking at f's RHS, |
|---|
| 153 | but that's not so good when f and g both have RULES, and both rules |
|---|
| 154 | mention the other. |
|---|
| 155 | |
|---|
| 156 | This change makes things simpler, but shouldn't change performance. |
|---|
| 157 | |
|---|
| 158 | ] |
|---|
| 159 | [Add floating-point symbols to the list |
|---|
| 160 | simonpj@microsoft.com**20060228114502] |
|---|
| 161 | [slightly better dependencies for GenApply.hs |
|---|
| 162 | Simon Marlow <simonmar@microsoft.com>**20060227153828] |
|---|
| 163 | [x86_64: include .type and .size directives in the output, for valgrind |
|---|
| 164 | Simon Marlow <simonmar@microsoft.com>**20060227152822] |
|---|
| 165 | [The initStablePtrTable should be called before ACQUIRE_LOCK(&stable_mutex) |
|---|
| 166 | kr.angelov@gmail.com**20060222202912] |
|---|
| 167 | [support LOCK_DEBUG for Windows |
|---|
| 168 | kr.angelov@gmail.com**20060222201721] |
|---|
| 169 | [mmap() errors on Darwin: use errorBelch/exit instead of barf() |
|---|
| 170 | Simon Marlow <simonmar@microsoft.com>**20060227111103 |
|---|
| 171 | |
|---|
| 172 | The most likely cause is out-of-memory, not an RTS error. |
|---|
| 173 | ] |
|---|
| 174 | [remove empty .SECONDARY target |
|---|
| 175 | Simon Marlow <simonmar@microsoft.com>**20060227105939 |
|---|
| 176 | |
|---|
| 177 | This works around a problem with recent versions of GNU make that take |
|---|
| 178 | a long time when all targets are declared intermediate with |
|---|
| 179 | .SECONDARY. See |
|---|
| 180 | |
|---|
| 181 | https://savannah.gnu.org/bugs/?func=detailitem&item_id=15584 |
|---|
| 182 | |
|---|
| 183 | for discussion of the GNU make issue. |
|---|
| 184 | ] |
|---|
| 185 | [these tables have four columns, not three |
|---|
| 186 | claus.reinke@talk21.com**20060225215945] |
|---|
| 187 | [Remove comment about imports and exports not being in the renamer result. |
|---|
| 188 | Lemmih <lemmih@gmail.com>**20060226120407] |
|---|
| 189 | [NCG: fix mkRegRegMoveInstr for x86-64 |
|---|
| 190 | wolfgang.thaller@gmx.net**20060225225920] |
|---|
| 191 | [NCG: Fix Typo in Register Allocator Loop Patch |
|---|
| 192 | wolfgang.thaller@gmx.net**20060225033954 |
|---|
| 193 | |
|---|
| 194 | Fix previous patch "NCG: Handle loops in register allocator" |
|---|
| 195 | Of course, I broke it when correcting a style problem just before committing. |
|---|
| 196 | ] |
|---|
| 197 | [NCG: Handle loops in register allocator |
|---|
| 198 | wolfgang.thaller@gmx.net**20060225031434 |
|---|
| 199 | |
|---|
| 200 | Fill in the missing parts in the register allocator so that it can |
|---|
| 201 | handle loops. |
|---|
| 202 | |
|---|
| 203 | *) The register allocator now runs in the UniqSuppy monad, as it needs |
|---|
| 204 | to be able to generate unique labels for fixup code blocks. |
|---|
| 205 | |
|---|
| 206 | *) A few functions have been added to RegAllocInfo: |
|---|
| 207 | mkRegRegMoveInstr -- generates a good old move instruction |
|---|
| 208 | mkBranchInstr -- used to be MachCodeGen.genBranch |
|---|
| 209 | patchJump -- Change the destination of a jump |
|---|
| 210 | |
|---|
| 211 | *) The register allocator now makes sure that only one spill slot is used |
|---|
| 212 | for each temporary, even if it is spilled and reloaded several times. |
|---|
| 213 | This obviates the need for memory-to-memory moves in fixup code. |
|---|
| 214 | |
|---|
| 215 | LIMITATIONS: |
|---|
| 216 | |
|---|
| 217 | *) The case where the fixup code needs to cyclically permute a group of |
|---|
| 218 | registers is currently unhandled. This will need more work once we come |
|---|
| 219 | accross code where this actually happens. |
|---|
| 220 | |
|---|
| 221 | *) Register allocation for code with loop is probably very inefficient |
|---|
| 222 | (both at compile-time and at run-time). |
|---|
| 223 | |
|---|
| 224 | *) We still cannot compile the RTS via NCG, for various other reasons. |
|---|
| 225 | |
|---|
| 226 | ] |
|---|
| 227 | [Oops, I got a little trigger happy while trimming package.conf.in. |
|---|
| 228 | Lemmih <lemmih@gmail.com>**20060224223704] |
|---|
| 229 | [Prettify parts of RnNames. No change of functionality. |
|---|
| 230 | Lemmih <lemmih@gmail.com>**20060224215020] |
|---|
| 231 | [Remove duplicate code from RnNames. |
|---|
| 232 | Lemmih <lemmih@gmail.com>**20060224212748] |
|---|
| 233 | [Remove non-existing modules from package.conf.in |
|---|
| 234 | Lemmih <lemmih@gmail.com>**20060224203727] |
|---|
| 235 | [Remove some unused bindings frm RnNames. |
|---|
| 236 | Lemmih <lemmih@gmail.com>**20060224165409] |
|---|
| 237 | [Rather large refactoring of RnNames. |
|---|
| 238 | Lemmih <lemmih@gmail.com>**20060224154704 |
|---|
| 239 | |
|---|
| 240 | This restructoring makes the renamed export and import lists |
|---|
| 241 | available in IDE mode. |
|---|
| 242 | |
|---|
| 243 | ] |
|---|
| 244 | [add file to go with "extract some of the generic..." patch |
|---|
| 245 | Simon Marlow <simonmar@microsoft.com>**20060224144126] |
|---|
| 246 | [oops, undo accidental addition of package-time settings |
|---|
| 247 | Simon Marlow <simonmar@microsoft.com>**20060224143051] |
|---|
| 248 | [turn off a trace |
|---|
| 249 | Simon Marlow <simonmar@microsoft.com>**20060224124608] |
|---|
| 250 | [add instance Outputable CLabel |
|---|
| 251 | Simon Marlow <simonmar@microsoft.com>**20060224124349] |
|---|
| 252 | [-O2 implies -optc-O2 now |
|---|
| 253 | Simon Marlow <simonmar@microsoft.com>**20060224124033] |
|---|
| 254 | [extract some of the generic C-- optimisations from the NCG |
|---|
| 255 | Simon Marlow <simonmar@microsoft.com>**20060224111753] |
|---|
| 256 | [lag/drag/void: add an extra assertion, and some commentary |
|---|
| 257 | Simon Marlow <simonmar@microsoft.com>**20060223155120] |
|---|
| 258 | [lag/drag/void profiling fix |
|---|
| 259 | Simon Marlow <simonmar@microsoft.com>**20060223155046 |
|---|
| 260 | |
|---|
| 261 | We were searching the wrong part of the heap for dead objects, this |
|---|
| 262 | was broken by recent changes to the step structure: from-space is now |
|---|
| 263 | in step->old_blocks, not step->blocks. Fortunately some assertions in |
|---|
| 264 | ProfHeap picked up the problem. |
|---|
| 265 | ] |
|---|
| 266 | [add (trivial) support for STM objects in lag/drag/void profiling |
|---|
| 267 | Simon Marlow <simonmar@microsoft.com>**20060223154859] |
|---|
| 268 | [bugfix for LDV profiling on 64-bit platforms |
|---|
| 269 | Simon Marlow <simonmar@microsoft.com>**20060223150904 |
|---|
| 270 | |
|---|
| 271 | There was an integer overflow in the definition of LDV_RECORD_CREATE |
|---|
| 272 | when StgWord is 64 bits. |
|---|
| 273 | ] |
|---|
| 274 | [warning fix |
|---|
| 275 | Simon Marlow <simonmar@microsoft.com>**20060223144537] |
|---|
| 276 | [further fix for floating point primitives |
|---|
| 277 | Simon Marlow <simonmar@microsoft.com>**20060223143013] |
|---|
| 278 | [Comment wibbles |
|---|
| 279 | simonpj@microsoft.com**20060223142101] |
|---|
| 280 | [Wibbles to instance validity checking |
|---|
| 281 | simonpj@microsoft.com**20060223134154] |
|---|
| 282 | [Fix comment |
|---|
| 283 | simonpj@microsoft.com**20060223130104] |
|---|
| 284 | [Improve error reporting for type-improvement errors |
|---|
| 285 | simonpj@microsoft.com**20060223130029] |
|---|
| 286 | [Reject polytypes in instance declarations (for now anyway) |
|---|
| 287 | simonpj@microsoft.com**20060223125958] |
|---|
| 288 | [Remove duplicate comment |
|---|
| 289 | simonpj@microsoft.com**20060210104028] |
|---|
| 290 | [Add renamed fixities to HsGroup. |
|---|
| 291 | Lemmih <lemmih@gmail.com>**20060222173648] |
|---|
| 292 | [oops, initialize atomic_modify_mutvar_mutex |
|---|
| 293 | Simon Marlow <simonmar@microsoft.com>**20060222163827] |
|---|
| 294 | [check black holes before doing GC in scheduleDoHeapProfile() |
|---|
| 295 | Simon Marlow <simonmar@microsoft.com>**20060222160733 |
|---|
| 296 | |
|---|
| 297 | fixes #687, see comment for details. |
|---|
| 298 | ] |
|---|
| 299 | [fix for ASSIGN_BaseReg() in the unregisterised way |
|---|
| 300 | Simon Marlow <simonmar@microsoft.com>**20060222141836] |
|---|
| 301 | [floating-point fix for x86_64 |
|---|
| 302 | Simon Marlow <simonmar@microsoft.com>**20060222140719 |
|---|
| 303 | |
|---|
| 304 | For 32-bit float primtives like sinFloat#, we currently call the |
|---|
| 305 | double versions of the C library functions (sin(), cos() etc.). It |
|---|
| 306 | seems more correct to call the float versions (sinf(), cosf() etc.). |
|---|
| 307 | This makes a difference on x86_64, I'm not entirely sure why, but this |
|---|
| 308 | way at least generates more consistent results and avoids extra |
|---|
| 309 | promotion/demotion instructions when calling these primitives. |
|---|
| 310 | |
|---|
| 311 | ] |
|---|
| 312 | [fix a deadlock in atomicModifyMutVar# |
|---|
| 313 | Simon Marlow <simonmar@microsoft.com>**20060221163711 |
|---|
| 314 | |
|---|
| 315 | atomicModifyMutVar# was re-using the storage manager mutex (sm_mutex) |
|---|
| 316 | to get its atomicity guarantee in SMP mode. But recently the addition |
|---|
| 317 | of a call to dirty_MUT_VAR() to implement the read barrier lead to a |
|---|
| 318 | rare deadlock case, because dirty_MUT_VAR() very occasionally needs to |
|---|
| 319 | allocate a new block to chain on the mutable list, which requires |
|---|
| 320 | sm_mutex. |
|---|
| 321 | ] |
|---|
| 322 | [warning fix |
|---|
| 323 | Simon Marlow <simonmar@microsoft.com>**20060221163308] |
|---|
| 324 | [Mention the 'Encoding' module in package.conf.in |
|---|
| 325 | Lemmih <lemmih@gmail.com>**20060221105147] |
|---|
| 326 | [Loosen the rules for instance declarations (Part 3) |
|---|
| 327 | Ross Paterson <ross@soi.city.ac.uk>**20060213161044 |
|---|
| 328 | |
|---|
| 329 | Relax the restrictions on derived instances in the same way, so we |
|---|
| 330 | can write |
|---|
| 331 | |
|---|
| 332 | data MinHeap h a = H a (h a) deriving (Show) |
|---|
| 333 | ] |
|---|
| 334 | [If we don't have libreadline then we need some dummy definition for complete* functions. |
|---|
| 335 | kr.angelov@gmail.com**20060212095019] |
|---|
| 336 | [SMP bugfix: reload capability from task->cap after scheduleDoGC |
|---|
| 337 | wolfgang.thaller@gmx.net**20060212034736] |
|---|
| 338 | [SMP support (xchg(), cas() and mb()) for PowerPC |
|---|
| 339 | wolfgang.thaller@gmx.net**20060212033352] |
|---|
| 340 | [Bugfix in completion code for :set and :unset. |
|---|
| 341 | Lemmih <lemmih@gmail.com>**20060210181319] |
|---|
| 342 | [Completion for :set, :unset and :undef. |
|---|
| 343 | Lemmih <lemmih@gmail.com>**20060210171728] |
|---|
| 344 | [oops, forgot some more SMP->THREADED_RTS conversions |
|---|
| 345 | Simon Marlow <simonmar@microsoft.com>**20060210153236] |
|---|
| 346 | [fix test for REG_BaseReg (it's spelled REG_Base) |
|---|
| 347 | Simon Marlow <simonmar@microsoft.com>**20060210123552] |
|---|
| 348 | [Change CVS for _darcs in dirs to prune during make dist |
|---|
| 349 | Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060209093204] |
|---|
| 350 | [fix for dirty_MUT_VAR: don't try to recordMutableCap in gen 0 |
|---|
| 351 | Simon Marlow <simonmar@microsoft.com>**20060210120021] |
|---|
| 352 | [STM fix from Tim Harris |
|---|
| 353 | Simon Marlow <simonmar@microsoft.com>**20060210112111 |
|---|
| 354 | |
|---|
| 355 | Fixes assertion failures with STM and -debug. Tim says: |
|---|
| 356 | Sorry, it's a problem in how nested transactions are handled in |
|---|
| 357 | non-SMP builds. It'll bite when trying to commit a nested transaction |
|---|
| 358 | which has read from a TVar but not updated it. |
|---|
| 359 | |
|---|
| 360 | The call to validate_and_acquire_ownership in |
|---|
| 361 | stmCommitNestedTransaction should be the same as that in |
|---|
| 362 | stmCommitNestedTransaction, i.e.: |
|---|
| 363 | |
|---|
| 364 | result = validate_and_acquire_ownership(trec, (!use_read_phase), TRUE); |
|---|
| 365 | |
|---|
| 366 | ] |
|---|
| 367 | [improvement to the deadlock detection |
|---|
| 368 | Simon Marlow <simonmar@microsoft.com>*-20060209123056 |
|---|
| 369 | |
|---|
| 370 | When the RTS is idle, as detected by the timer signal, instead of |
|---|
| 371 | prodding capabilities from the signal handler (which is not guaranteed |
|---|
| 372 | to work - pthread_cond_signal() can't be called from signal handlers), |
|---|
| 373 | create a new thread to do it. |
|---|
| 374 | ] |
|---|
| 375 | [Simplify the -B handling. The interface to the ghc library has changed slightly. |
|---|
| 376 | Lemmih <lemmih@gmail.com>**20060210094601] |
|---|
| 377 | [Fix desugaring of unboxed tuples |
|---|
| 378 | simonpj@microsoft.com**20060209175328 |
|---|
| 379 | |
|---|
| 380 | This patch is a slightly-unsatisfactory fix to desugaring unboxed |
|---|
| 381 | tuples; it fixes ds057 which has been failing for some time. |
|---|
| 382 | |
|---|
| 383 | Unsatisfactory because rather ad hoc -- but that applies to lots |
|---|
| 384 | of the unboxed tuple stuff. |
|---|
| 385 | |
|---|
| 386 | ] |
|---|
| 387 | [x86_64: fix case of out-of-range operands to leaq |
|---|
| 388 | Simon Marlow <simonmar@microsoft.com>**20060209162247] |
|---|
| 389 | [Merge the smp and threaded RTS ways |
|---|
| 390 | Simon Marlow <simonmar@microsoft.com>**20060209154449 |
|---|
| 391 | |
|---|
| 392 | Now, the threaded RTS also includes SMP support. The -smp flag is a |
|---|
| 393 | synonym for -threaded. The performance implications of this are small |
|---|
| 394 | to negligible, and it results in a code cleanup and reduces the number |
|---|
| 395 | of combinations we have to test. |
|---|
| 396 | ] |
|---|
| 397 | [change dirty_MUT_VAR() to use recordMutableCap() |
|---|
| 398 | Simon Marlow <simonmar@microsoft.com>**20060209150420 |
|---|
| 399 | rather than recordMutableGen(), the former works better in SMP |
|---|
| 400 | ] |
|---|
| 401 | [improvement to the deadlock detection |
|---|
| 402 | Simon Marlow <simonmar@microsoft.com>**20060209123056 |
|---|
| 403 | |
|---|
| 404 | When the RTS is idle, as detected by the timer signal, instead of |
|---|
| 405 | prodding capabilities from the signal handler (which is not guaranteed |
|---|
| 406 | to work - pthread_cond_signal() can't be called from signal handlers), |
|---|
| 407 | create a new thread to do it. |
|---|
| 408 | ] |
|---|
| 409 | [Fix typo |
|---|
| 410 | simonpj@microsoft.com**20060209124208] |
|---|
| 411 | [Fix instance rules for functional dependencies |
|---|
| 412 | simonpj@microsoft.com**20060209113531 |
|---|
| 413 | |
|---|
| 414 | GHC 6.4 implements a rather relaxed version of the Coverage Condition |
|---|
| 415 | which is actually too relaxed: the compiler can get into an infinite loop |
|---|
| 416 | as a result. |
|---|
| 417 | |
|---|
| 418 | This commit fixes the problem (see Note [Coverage condition] in FunDeps.lhs) |
|---|
| 419 | and documents the change. |
|---|
| 420 | |
|---|
| 421 | I also took the opportunity to add documentation about functional dependencies, |
|---|
| 422 | taken from the Hugs manual with kind permission of Mark Jones |
|---|
| 423 | |
|---|
| 424 | ] |
|---|
| 425 | [fix for the unregisterised way |
|---|
| 426 | Simon Marlow <simonmar@microsoft.com>**20060209105058 |
|---|
| 427 | |
|---|
| 428 | We always assign to BaseReg on return from resumeThread(), but in |
|---|
| 429 | cases where BaseReg is not an lvalue (eg. unreg) we need to disable |
|---|
| 430 | this assigment. See comments for more details. |
|---|
| 431 | ] |
|---|
| 432 | [prof/smp combination probably doesn't work, disable it |
|---|
| 433 | Simon Marlow <simonmar@microsoft.com>**20060209104815] |
|---|
| 434 | [tiny panic msg fix |
|---|
| 435 | Simon Marlow <simonmar@microsoft.com>**20060209102540] |
|---|
| 436 | [Loosen the rules for instance declarations (Part 2) |
|---|
| 437 | simonpj@microsoft.com**20060209102129 |
|---|
| 438 | |
|---|
| 439 | Tidying up to Ross's patch, plus adding documenation for it. |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | ] |
|---|
| 443 | [relaxed instance termination test |
|---|
| 444 | Ross Paterson <ross@soi.city.ac.uk>**20060206111651 |
|---|
| 445 | |
|---|
| 446 | With -fglasgow-exts but not -fallow-undecidable-instances, GHC 6.4 |
|---|
| 447 | requires that instances be of the following form: |
|---|
| 448 | |
|---|
| 449 | (1) each assertion in the context must constrain distinct variables |
|---|
| 450 | mentioned in the head, and |
|---|
| 451 | |
|---|
| 452 | (2) at least one argument of the head must be a non-variable type. |
|---|
| 453 | |
|---|
| 454 | This patch replaces these rules with the requirement that each assertion |
|---|
| 455 | in the context satisfy |
|---|
| 456 | |
|---|
| 457 | (1) no variable has more occurrences in the assertion than in the head, and |
|---|
| 458 | |
|---|
| 459 | (2) the assertion has fewer constructors and variables (taken together |
|---|
| 460 | and counting repetitions) than the head. |
|---|
| 461 | |
|---|
| 462 | This allows all instances permitted by the old rule, plus such instances as |
|---|
| 463 | |
|---|
| 464 | instance C a |
|---|
| 465 | instance Show (s a) => Show (Sized s a) |
|---|
| 466 | instance (Eq a, Show b) => C2 a b |
|---|
| 467 | instance C2 Int a => C3 Bool [a] |
|---|
| 468 | instance C2 Int a => C3 [a] b |
|---|
| 469 | instance C4 a a => C4 [a] [a] |
|---|
| 470 | |
|---|
| 471 | but still ensures that under any substitution assertions in the context |
|---|
| 472 | will be smaller than the head, so context reduction must terminate. |
|---|
| 473 | |
|---|
| 474 | This is probably the best we can do if we consider each instance in |
|---|
| 475 | isolation. |
|---|
| 476 | ] |
|---|
| 477 | [Fix CPP failure by adding space before hASH_TBL_SIZE |
|---|
| 478 | simonpj@microsoft.com**20060209093704] |
|---|
| 479 | [an LDV profiling fix (might just fix ASSERTIONs, I'm not sure) |
|---|
| 480 | Simon Marlow <simonmar@microsoft.com>**20060208170744] |
|---|
| 481 | [Do type refinement in TcIface |
|---|
| 482 | simonpj@microsoft.com**20060208154412 |
|---|
| 483 | |
|---|
| 484 | This commit fixes a bug in 6.4.1 and the HEAD. Consider this code, |
|---|
| 485 | recorded **in an interface file** |
|---|
| 486 | |
|---|
| 487 | \(x::a) -> case y of |
|---|
| 488 | MkT -> case x of { True -> ... } |
|---|
| 489 | (where MkT forces a=Bool) |
|---|
| 490 | |
|---|
| 491 | In the "case x" we need to know x's type, because we use that |
|---|
| 492 | to find which module to look for "True" in. x's type comes from |
|---|
| 493 | the envt, so we must refine the envt. |
|---|
| 494 | |
|---|
| 495 | The alternative would be to record more info with an IfaceCase, |
|---|
| 496 | but that would change the interface file format. |
|---|
| 497 | |
|---|
| 498 | (This stuff will go away when we have proper coercions.) |
|---|
| 499 | |
|---|
| 500 | ] |
|---|
| 501 | [Add mapOccEnv |
|---|
| 502 | simonpj@microsoft.com**20060208154343] |
|---|
| 503 | [A little more debug printing |
|---|
| 504 | simonpj@microsoft.com**20060208150701] |
|---|
| 505 | [Show types of case result when debug is on |
|---|
| 506 | simonpj@microsoft.com**20060208150357] |
|---|
| 507 | [fix installation of binary dist when the PS docs aren't present |
|---|
| 508 | Simon Marlow <simonmar@microsoft.com>**20060208153259 |
|---|
| 509 | |
|---|
| 510 | Fixes #660 |
|---|
| 511 | ] |
|---|
| 512 | [fix a bug in closure_sizeW_() |
|---|
| 513 | Simon Marlow <simonmar@microsoft.com>**20060208145451] |
|---|
| 514 | [make the smp way RTS-only, normal libraries now work with -smp |
|---|
| 515 | Simon Marlow <simonmar@microsoft.com>**20060208143348 |
|---|
| 516 | |
|---|
| 517 | We had to bite the bullet here and add an extra word to every thunk, |
|---|
| 518 | to enable running ordinary libraries on SMP. Otherwise, we would have |
|---|
| 519 | needed to ship an extra set of libraries with GHC 6.6 in addition to |
|---|
| 520 | the two sets we already ship (normal + profiled), and all Cabal |
|---|
| 521 | packages would have to be compiled for SMP too. We decided it best |
|---|
| 522 | just to take the hit now, making SMP easily accessible to everyone in |
|---|
| 523 | GHC 6.6. |
|---|
| 524 | |
|---|
| 525 | Incedentally, although this increases allocation by around 12% on |
|---|
| 526 | average, the performance hit is around 5%, and much less if your inner |
|---|
| 527 | loop doesn't use any laziness. |
|---|
| 528 | ] |
|---|
| 529 | [add -dfaststring-stats to dump some stats about the FastString hash table |
|---|
| 530 | Simon Marlow <simonmar@microsoft.com>**20060208131018] |
|---|
| 531 | [fix a warning |
|---|
| 532 | Simon Marlow <simonmar@microsoft.com>**20060207132323] |
|---|
| 533 | [catch up with changes to Distribution.ParseUtils.ParseResult |
|---|
| 534 | Simon Marlow <simonmar@microsoft.com>**20060207111111] |
|---|
| 535 | [Wibble to type signature |
|---|
| 536 | simonpj@microsoft.com**20060207171254] |
|---|
| 537 | [Empty forall should disable implicit quantification |
|---|
| 538 | simonpj@microsoft.com**20060207085137] |
|---|
| 539 | [Remove unused constructor in SourceTypeCtxt |
|---|
| 540 | simonpj@microsoft.com**20060206112031] |
|---|
| 541 | [Basic completion in GHCi |
|---|
| 542 | Simon Marlow <simonmar@microsoft.com>**20060206122654 |
|---|
| 543 | |
|---|
| 544 | This patch adds completion support to GHCi when readline is being |
|---|
| 545 | used. Completion of identifiers (in scope only, but including |
|---|
| 546 | qualified identifiers) in expressions is provided. Also, completion |
|---|
| 547 | of commands (:cmd), and special completion for certain commands |
|---|
| 548 | (eg. module names for the :module command) are also provided. |
|---|
| 549 | ] |
|---|
| 550 | [Improve error report for pattern guards |
|---|
| 551 | simonpj@microsoft.com**20060206101730] |
|---|
| 552 | [Add bang patterns |
|---|
| 553 | simonpj@microsoft.com**20060203175108 |
|---|
| 554 | |
|---|
| 555 | This commit adds bang-patterns, |
|---|
| 556 | enabled by -fglasgow-exts or -fbang-patterns |
|---|
| 557 | diabled by -fno-bang-patterns |
|---|
| 558 | |
|---|
| 559 | The idea is described here |
|---|
| 560 | http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/BangPatterns |
|---|
| 561 | |
|---|
| 562 | ] |
|---|
| 563 | [Add Bag.anyBag (analogous to List.any) |
|---|
| 564 | simonpj@microsoft.com**20060203174627] |
|---|
| 565 | [Deal correctly with lazy patterns and GADTs |
|---|
| 566 | simonpj@microsoft.com**20060202130409] |
|---|
| 567 | [Record the type in TuplePat (necessary for GADTs) |
|---|
| 568 | simonpj@microsoft.com**20060202124405 |
|---|
| 569 | |
|---|
| 570 | We must record the type of a TuplePat after typechecking, just like a ConPatOut, |
|---|
| 571 | so that desugaring works correctly for GADTs. See comments with the declaration |
|---|
| 572 | of HsPat.TuplePat, and test gadt15 |
|---|
| 573 | |
|---|
| 574 | ] |
|---|
| 575 | [Improve error reporting in Core Lint |
|---|
| 576 | simonpj@microsoft.com**20060202124327] |
|---|
| 577 | [don't clean ghc-inplace when cleaning stages other than 1 |
|---|
| 578 | Simon Marlow <simonmar@microsoft.com>**20060202124359] |
|---|
| 579 | [Improve error reporting in typechecker |
|---|
| 580 | simonpj@microsoft.com**20060201170332] |
|---|
| 581 | [Trim imports |
|---|
| 582 | simonpj@microsoft.com**20060201170248] |
|---|
| 583 | [Yet another fix to an old hi-boot-6 file |
|---|
| 584 | simonpj@microsoft.com**20060201105544] |
|---|
| 585 | [Kinding wibble in TH brackets |
|---|
| 586 | simonpj@microsoft.com**20060131175730] |
|---|
| 587 | [Use extraGHCiLibraries (if supplied) in GHCi linker rather than extraLibraries |
|---|
| 588 | Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20051207105654 |
|---|
| 589 | Also extend the parser. |
|---|
| 590 | ] |
|---|
| 591 | [combine libraries/.darcs-boring and .darcs-boring |
|---|
| 592 | Simon Marlow <simonmar@microsoft.com>**20060131161530] |
|---|
| 593 | [Fix long-standing bug in CPR analysis |
|---|
| 594 | simonpj@microsoft.com**20060131153247 |
|---|
| 595 | |
|---|
| 596 | MERGE TO STABLE |
|---|
| 597 | |
|---|
| 598 | For a long time (2002!) the CPR analysis done by |
|---|
| 599 | dmdAnalTopRhs has been bogus. In particular, it's possible |
|---|
| 600 | for a newtype constructor to look CPR-ish when it simply isn't. |
|---|
| 601 | |
|---|
| 602 | This fixes it. Test is stranal/newtype |
|---|
| 603 | |
|---|
| 604 | |
|---|
| 605 | |
|---|
| 606 | ] |
|---|
| 607 | [More hi-boot-6 updates |
|---|
| 608 | simonpj@microsoft.com**20060131130926] |
|---|
| 609 | [Fix TcUnify.subFunTys in AppTy case |
|---|
| 610 | simonpj@microsoft.com**20060131122420 |
|---|
| 611 | |
|---|
| 612 | subFunTys wasn't dealing correctly with the case where the type |
|---|
| 613 | to be split was of form (a ty1), where a is a type variable. |
|---|
| 614 | |
|---|
| 615 | This shows up when compiling |
|---|
| 616 | Control.Arrow.Transformer.Stream |
|---|
| 617 | in package arrows. |
|---|
| 618 | |
|---|
| 619 | This commit fixes it. |
|---|
| 620 | |
|---|
| 621 | |
|---|
| 622 | ] |
|---|
| 623 | [Error message wibble |
|---|
| 624 | simonpj@microsoft.com**20060130163651] |
|---|
| 625 | [Add mkHsCoerce to avoid junk in typechecked code |
|---|
| 626 | simonpj@microsoft.com**20060130131231 |
|---|
| 627 | |
|---|
| 628 | Avoiding identity coercions is a Good Thing generally, but |
|---|
| 629 | it turns out that the desugarer has trouble recognising |
|---|
| 630 | 'otherwise' and 'True' guards if they are wrapped in an |
|---|
| 631 | identity coercion; and that leads to bogus overlap warnings. |
|---|
| 632 | |
|---|
| 633 | ] |
|---|
| 634 | [Improve error messsage when argument count varies |
|---|
| 635 | simonpj@microsoft.com**20060130131133] |
|---|
| 636 | [fix bug #664 in printSample() |
|---|
| 637 | Simon Marlow <simonmar@microsoft.com>**20060130115301 |
|---|
| 638 | printSample() was attempting to round the fractional part of the time, |
|---|
| 639 | but not propagated to the non-fractional part. It's probably better not |
|---|
| 640 | to attempt to round the time at all. |
|---|
| 641 | ] |
|---|
| 642 | [Fix hi-boot file for earlier versions of GHC |
|---|
| 643 | simonpj@microsoft.com**20060127175040] |
|---|
| 644 | [Fix typo in boxy matching |
|---|
| 645 | simonpj@microsoft.com**20060127174536] |
|---|
| 646 | [fix one case where -q wasn't honoured |
|---|
| 647 | Simon Marlow <simonmar@microsoft.com>**20060127104715] |
|---|
| 648 | [Check for GMP.framework on all Darwin platforms, not just PPC |
|---|
| 649 | wolfgang.thaller@gmx.net**20060126071504] |
|---|
| 650 | [Simon's big boxy-type commit |
|---|
| 651 | simonpj@microsoft.com**20060125162832 |
|---|
| 652 | |
|---|
| 653 | This very large commit adds impredicativity to GHC, plus |
|---|
| 654 | numerous other small things. |
|---|
| 655 | |
|---|
| 656 | *** WARNING: I have compiled all the libraries, and |
|---|
| 657 | *** a stage-2 compiler, and everything seems |
|---|
| 658 | *** fine. But don't grab this patch if you |
|---|
| 659 | *** can't tolerate a hiccup if something is |
|---|
| 660 | *** broken. |
|---|
| 661 | |
|---|
| 662 | The big picture is this: |
|---|
| 663 | |
|---|
| 664 | a) GHC handles impredicative polymorphism, as described in the |
|---|
| 665 | "Boxy types: type inference for higher-rank types and |
|---|
| 666 | impredicativity" paper |
|---|
| 667 | |
|---|
| 668 | b) GHC handles GADTs in the new simplified (and very sligtly less |
|---|
| 669 | epxrssive) way described in the |
|---|
| 670 | "Simple unification-based type inference for GADTs" paper |
|---|
| 671 | |
|---|
| 672 | |
|---|
| 673 | But there are lots of smaller changes, and since it was pre-Darcs |
|---|
| 674 | they are not individually recorded. |
|---|
| 675 | |
|---|
| 676 | Some things to watch out for: |
|---|
| 677 | |
|---|
| 678 | c) The story on lexically-scoped type variables has changed, as per |
|---|
| 679 | my email. I append the story below for completeness, but I |
|---|
| 680 | am still not happy with it, and it may change again. In particular, |
|---|
| 681 | the new story does not allow a pattern-bound scoped type variable |
|---|
| 682 | to be wobbly, so (\(x::[a]) -> ...) is usually rejected. This is |
|---|
| 683 | more restrictive than before, and we might loosen up again. |
|---|
| 684 | |
|---|
| 685 | d) A consequence of adding impredicativity is that GHC is a bit less |
|---|
| 686 | gung ho about converting automatically between |
|---|
| 687 | (ty1 -> forall a. ty2) and (forall a. ty1 -> ty2) |
|---|
| 688 | In particular, you may need to eta-expand some functions to make |
|---|
| 689 | typechecking work again. |
|---|
| 690 | |
|---|
| 691 | Furthermore, functions are now invariant in their argument types, |
|---|
| 692 | rather than being contravariant. Again, the main consequence is |
|---|
| 693 | that you may occasionally need to eta-expand function arguments when |
|---|
| 694 | using higher-rank polymorphism. |
|---|
| 695 | |
|---|
| 696 | |
|---|
| 697 | Please test, and let me know of any hiccups |
|---|
| 698 | |
|---|
| 699 | |
|---|
| 700 | Scoped type variables in GHC |
|---|
| 701 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 702 | January 2006 |
|---|
| 703 | |
|---|
| 704 | 0) Terminology. |
|---|
| 705 | |
|---|
| 706 | A *pattern binding* is of the form |
|---|
| 707 | pat = rhs |
|---|
| 708 | |
|---|
| 709 | A *function binding* is of the form |
|---|
| 710 | f pat1 .. patn = rhs |
|---|
| 711 | |
|---|
| 712 | A binding of the formm |
|---|
| 713 | var = rhs |
|---|
| 714 | is treated as a (degenerate) *function binding*. |
|---|
| 715 | |
|---|
| 716 | |
|---|
| 717 | A *declaration type signature* is a separate type signature for a |
|---|
| 718 | let-bound or where-bound variable: |
|---|
| 719 | f :: Int -> Int |
|---|
| 720 | |
|---|
| 721 | A *pattern type signature* is a signature in a pattern: |
|---|
| 722 | \(x::a) -> x |
|---|
| 723 | f (x::a) = x |
|---|
| 724 | |
|---|
| 725 | A *result type signature* is a signature on the result of a |
|---|
| 726 | function definition: |
|---|
| 727 | f :: forall a. [a] -> a |
|---|
| 728 | head (x:xs) :: a = x |
|---|
| 729 | |
|---|
| 730 | The form |
|---|
| 731 | x :: a = rhs |
|---|
| 732 | is treated as a (degnerate) function binding with a result |
|---|
| 733 | type signature, not as a pattern binding. |
|---|
| 734 | |
|---|
| 735 | 1) The main invariants: |
|---|
| 736 | |
|---|
| 737 | A) A lexically-scoped type variable always names a (rigid) |
|---|
| 738 | type variable (not an arbitrary type). THIS IS A CHANGE. |
|---|
| 739 | Previously, a scoped type variable named an arbitrary *type*. |
|---|
| 740 | |
|---|
| 741 | B) A type signature always describes a rigid type (since |
|---|
| 742 | its free (scoped) type variables name rigid type variables). |
|---|
| 743 | This is also a change, a consequence of (A). |
|---|
| 744 | |
|---|
| 745 | C) Distinct lexically-scoped type variables name distinct |
|---|
| 746 | rigid type variables. This choice is open; |
|---|
| 747 | |
|---|
| 748 | 2) Scoping |
|---|
| 749 | |
|---|
| 750 | 2(a) If a declaration type signature has an explicit forall, those type |
|---|
| 751 | variables are brought into scope in the right hand side of the |
|---|
| 752 | corresponding binding (plus, for function bindings, the patterns on |
|---|
| 753 | the LHS). |
|---|
| 754 | f :: forall a. a -> [a] |
|---|
| 755 | f (x::a) = [x :: a, x] |
|---|
| 756 | Both occurences of 'a' in the second line are bound by |
|---|
| 757 | the 'forall a' in the first line |
|---|
| 758 | |
|---|
| 759 | A declaration type signature *without* an explicit top-level forall |
|---|
| 760 | is implicitly quantified over all the type variables that are |
|---|
| 761 | mentioned in the type but not already in scope. GHC's current |
|---|
| 762 | rule is that this implicit quantification does *not* bring into scope |
|---|
| 763 | any new scoped type variables. |
|---|
| 764 | f :: a -> a |
|---|
| 765 | f x = ...('a' is not in scope here)... |
|---|
| 766 | This gives compatibility with Haskell 98 |
|---|
| 767 | |
|---|
| 768 | 2(b) A pattern type signature implicitly brings into scope any type |
|---|
| 769 | variables mentioned in the type that are not already into scope. |
|---|
| 770 | These are called *pattern-bound type variables*. |
|---|
| 771 | g :: a -> a -> [a] |
|---|
| 772 | g (x::a) (y::a) = [y :: a, x] |
|---|
| 773 | The pattern type signature (x::a) brings 'a' into scope. |
|---|
| 774 | The 'a' in the pattern (y::a) is bound, as is the occurrence on |
|---|
| 775 | the RHS. |
|---|
| 776 | |
|---|
| 777 | A pattern type siganture is the only way you can bring existentials |
|---|
| 778 | into scope. |
|---|
| 779 | data T where |
|---|
| 780 | MkT :: forall a. a -> (a->Int) -> T |
|---|
| 781 | |
|---|
| 782 | f x = case x of |
|---|
| 783 | MkT (x::a) f -> f (x::a) |
|---|
| 784 | |
|---|
| 785 | 2a) QUESTION |
|---|
| 786 | class C a where |
|---|
| 787 | op :: forall b. b->a->a |
|---|
| 788 | |
|---|
| 789 | instance C (T p q) where |
|---|
| 790 | op = <rhs> |
|---|
| 791 | Clearly p,q are in scope in <rhs>, but is 'b'? Not at the moment. |
|---|
| 792 | Nor can you add a type signature for op in the instance decl. |
|---|
| 793 | You'd have to say this: |
|---|
| 794 | instance C (T p q) where |
|---|
| 795 | op = let op' :: forall b. ... |
|---|
| 796 | op' = <rhs> |
|---|
| 797 | in op' |
|---|
| 798 | |
|---|
| 799 | 3) A pattern-bound type variable is allowed only if the pattern's |
|---|
| 800 | expected type is rigid. Otherwise we don't know exactly *which* |
|---|
| 801 | skolem the scoped type variable should be bound to, and that means |
|---|
| 802 | we can't do GADT refinement. This is invariant (A), and it is a |
|---|
| 803 | big change from the current situation. |
|---|
| 804 | |
|---|
| 805 | f (x::a) = x -- NO; pattern type is wobbly |
|---|
| 806 | |
|---|
| 807 | g1 :: b -> b |
|---|
| 808 | g1 (x::b) = x -- YES, because the pattern type is rigid |
|---|
| 809 | |
|---|
| 810 | g2 :: b -> b |
|---|
| 811 | g2 (x::c) = x -- YES, same reason |
|---|
| 812 | |
|---|
| 813 | h :: forall b. b -> b |
|---|
| 814 | h (x::b) = x -- YES, but the inner b is bound |
|---|
| 815 | |
|---|
| 816 | k :: forall b. b -> b |
|---|
| 817 | k (x::c) = x -- NO, it can't be both b and c |
|---|
| 818 | |
|---|
| 819 | 3a) You cannot give different names for the same type variable in the same scope |
|---|
| 820 | (Invariant (C)): |
|---|
| 821 | |
|---|
| 822 | f1 :: p -> p -> p -- NO; because 'a' and 'b' would be |
|---|
| 823 | f1 (x::a) (y::b) = (x::a) -- bound to the same type variable |
|---|
| 824 | |
|---|
| 825 | f2 :: p -> p -> p -- OK; 'a' is bound to the type variable |
|---|
| 826 | f2 (x::a) (y::a) = (x::a) -- over which f2 is quantified |
|---|
| 827 | -- NB: 'p' is not lexically scoped |
|---|
| 828 | |
|---|
| 829 | f3 :: forall p. p -> p -> p -- NO: 'p' is now scoped, and is bound to |
|---|
| 830 | f3 (x::a) (y::a) = (x::a) -- to the same type varialble as 'a' |
|---|
| 831 | |
|---|
| 832 | f4 :: forall p. p -> p -> p -- OK: 'p' is now scoped, and its occurences |
|---|
| 833 | f4 (x::p) (y::p) = (x::p) -- in the patterns are bound by the forall |
|---|
| 834 | |
|---|
| 835 | |
|---|
| 836 | 3b) You can give a different name to the same type variable in different |
|---|
| 837 | disjoint scopes, just as you can (if you want) give diferent names to |
|---|
| 838 | the same value parameter |
|---|
| 839 | |
|---|
| 840 | g :: a -> Bool -> Maybe a |
|---|
| 841 | g (x::p) True = Just x :: Maybe p |
|---|
| 842 | g (y::q) False = Nothing :: Maybe q |
|---|
| 843 | |
|---|
| 844 | 3c) Scoped type variables respect alpha renaming. For example, |
|---|
| 845 | function f2 from (3a) above could also be written: |
|---|
| 846 | f2' :: p -> p -> p |
|---|
| 847 | f2' (x::b) (y::b) = x::b |
|---|
| 848 | where the scoped type variable is called 'b' instead of 'a'. |
|---|
| 849 | |
|---|
| 850 | |
|---|
| 851 | 4) Result type signatures obey the same rules as pattern types signatures. |
|---|
| 852 | In particular, they can bind a type variable only if the result type is rigid |
|---|
| 853 | |
|---|
| 854 | f x :: a = x -- NO |
|---|
| 855 | |
|---|
| 856 | g :: b -> b |
|---|
| 857 | g x :: b = x -- YES; binds b in rhs |
|---|
| 858 | |
|---|
| 859 | 5) A *pattern type signature* in a *pattern binding* cannot bind a |
|---|
| 860 | scoped type variable |
|---|
| 861 | |
|---|
| 862 | (x::a, y) = ... -- Legal only if 'a' is already in scope |
|---|
| 863 | |
|---|
| 864 | Reason: in type checking, the "expected type" of the LHS pattern is |
|---|
| 865 | always wobbly, so we can't bind a rigid type variable. (The exception |
|---|
| 866 | would be for an existential type variable, but existentials are not |
|---|
| 867 | allowed in pattern bindings either.) |
|---|
| 868 | |
|---|
| 869 | Even this is illegal |
|---|
| 870 | f :: forall a. a -> a |
|---|
| 871 | f x = let ((y::b)::a, z) = ... |
|---|
| 872 | in |
|---|
| 873 | Here it looks as if 'b' might get a rigid binding; but you can't bind |
|---|
| 874 | it to the same skolem as a. |
|---|
| 875 | |
|---|
| 876 | 6) Explicitly-forall'd type variables in the *declaration type signature(s)* |
|---|
| 877 | for a *pattern binding* do not scope AT ALL. |
|---|
| 878 | |
|---|
| 879 | x :: forall a. a->a -- NO; the forall a does |
|---|
| 880 | Just (x::a->a) = Just id -- not scope at all |
|---|
| 881 | |
|---|
| 882 | y :: forall a. a->a |
|---|
| 883 | Just y = Just (id :: a->a) -- NO; same reason |
|---|
| 884 | |
|---|
| 885 | THIS IS A CHANGE, but one I bet that very few people will notice. |
|---|
| 886 | Here's why: |
|---|
| 887 | |
|---|
| 888 | strange :: forall b. (b->b,b->b) |
|---|
| 889 | strange = (id,id) |
|---|
| 890 | |
|---|
| 891 | x1 :: forall a. a->a |
|---|
| 892 | y1 :: forall b. b->b |
|---|
| 893 | (x1,y1) = strange |
|---|
| 894 | |
|---|
| 895 | This is legal Haskell 98 (modulo the forall). If both 'a' and 'b' |
|---|
| 896 | both scoped over the RHS, they'd get unified and so cannot stand |
|---|
| 897 | for distinct type variables. One could *imagine* allowing this: |
|---|
| 898 | |
|---|
| 899 | x2 :: forall a. a->a |
|---|
| 900 | y2 :: forall a. a->a |
|---|
| 901 | (x2,y2) = strange |
|---|
| 902 | |
|---|
| 903 | using the very same type variable 'a' in both signatures, so that |
|---|
| 904 | a single 'a' scopes over the RHS. That seems defensible, but odd, |
|---|
| 905 | because though there are two type signatures, they introduce just |
|---|
| 906 | *one* scoped type variable, a. |
|---|
| 907 | |
|---|
| 908 | 7) Possible extension. We might consider allowing |
|---|
| 909 | \(x :: [ _ ]) -> <expr> |
|---|
| 910 | where "_" is a wild card, to mean "x has type list of something", without |
|---|
| 911 | naming the something. |
|---|
| 912 | |
|---|
| 913 | ] |
|---|
| 914 | [add double colon and double arrow symbols (-fglasgow-exts) |
|---|
| 915 | Simon Marlow <simonmar@microsoft.com>**20060125135501] |
|---|
| 916 | [Fix conDeclFVs for GADTs, to fix bogus unused-import warning |
|---|
| 917 | simonpj@microsoft.com**20060125090957] |
|---|
| 918 | [make the par# primop actually do something |
|---|
| 919 | Simon Marlow <simonmar@microsoft.com>**20060124162521] |
|---|
| 920 | [Update Cachegrind support for changes to the Valgrind CLI |
|---|
| 921 | Simon Marlow <simonmar@microsoft.com>**20060124154732] |
|---|
| 922 | [send usage info to stdout, not stderr |
|---|
| 923 | Simon Marlow <simonmar@microsoft.com>**20060124145551] |
|---|
| 924 | [primop-docs |
|---|
| 925 | Dinko Tenev <dinko.tenev@gmail.com>**20060122222446] |
|---|
| 926 | [remove old CVS stuff, replace with darcs |
|---|
| 927 | Simon Marlow <simonmar@microsoft.com>**20060120151322] |
|---|
| 928 | [implement clean/dirty TSOs |
|---|
| 929 | Simon Marlow <simonmar@microsoft.com>**20060123164930 |
|---|
| 930 | Along the lines of the clean/dirty arrays and IORefs implemented |
|---|
| 931 | recently, now threads are marked clean or dirty depending on whether |
|---|
| 932 | they need to be scanned during a minor GC or not. This should speed |
|---|
| 933 | up GC when there are lots of threads, especially if most of them are |
|---|
| 934 | idle. |
|---|
| 935 | ] |
|---|
| 936 | [Better error message for Template Haskell pattern brackets |
|---|
| 937 | simonpj@microsoft.com**20060123142838] |
|---|
| 938 | [remove old comment |
|---|
| 939 | Simon Marlow <simonmar@microsoft.com>**20060123140530] |
|---|
| 940 | [Fix for feature request #655 (Loading the GHC library from GHCi.) |
|---|
| 941 | Lemmih <lemmih@gmail.com>**20060123110625 |
|---|
| 942 | Moved the utility functions out of hschooks, avoided |
|---|
| 943 | linking the GHC library with hschooks.o and |
|---|
| 944 | added a couple of symbols to the linkers export list. |
|---|
| 945 | ] |
|---|
| 946 | [Make hsc2hs emit the full path name in {-# LINE #-} pagmas. |
|---|
| 947 | Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060122011831 |
|---|
| 948 | For one thing this is the right thing to do anyway, it's what other tools do. |
|---|
| 949 | Secondly it allows haddock to produce accurate source code links. |
|---|
| 950 | ] |
|---|
| 951 | [MFLAGS += -f Makefile |
|---|
| 952 | Simon Marlow <simonmar@microsoft.com>**20060123094837 |
|---|
| 953 | merged from CVS, because Tailor isn't merging the libraries subdir |
|---|
| 954 | ] |
|---|
| 955 | [undo accidental commit of snapshot version |
|---|
| 956 | Simon Marlow <simonmar@microsoft.com>**20060122175817] |
|---|
| 957 | [TAG final switch to darcs, this repo is now live |
|---|
| 958 | Simon Marlow <simonmar@microsoft.com>**20060120134630] |
|---|
| 959 | Patch bundle hash: |
|---|
| 960 | b691837701a84da698d5e800104d7d64f6fa9f11 |
|---|