Changes between Initial Version and Version 3 of Ticket #76
 Timestamp:
 Jan 19, 2006 9:57:42 AM (10 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #76
 Property Type changed from task to enhancement
 Property Component changed from HaskellPrime to Proposal

Ticket #76 – Description
initial v3 1 In this note I describe a proposed extension to Haskell that John Launchbury2 and I came up with while walking around Charleston after POPL'06.3 4 1 == Goal == 5 2 Our goal is to make it easier to write strict programs in … … 96 93 which evaluates the (f x), thereby giving a strict `let`. 97 94 98 Here is a more realistic example 95 Here is a more realistic example, a strict version of partition: 99 96 {{{ 100 partition p [] = ([], [])101 partition p (x:xs)97 partitionS p [] = ([], []) 98 partitionS p (x:xs) 102 99  p x = (x:ys, zs) 103 100  otherwise = (ys, x:zs) 104 101 where 105 !(ys,zs) = partition p xs102 !(ys,zs) = partitionS p xs 106 103 }}} 107 104 The bang in the where clause ensures that the recursive … … 109 106 write 110 107 {{{ 111 partition p [] = ([], [])112 partition p (x:xs)113 = case partition p xs of108 partitionS p [] = ([], []) 109 partitionS p (x:xs) 110 = case partitionS p xs of 114 111 (ys,zs)  p x = (x:ys, zs) 115 112  otherwise = (ys, x:zs) … … 120 117 needed in this example but often useful). 121 118 119 The 120 122 121 == Changes to the Report == 123 122 124 123 The changes to the Report would be these 125 124 126 * Section 3.17, add pat ::= !pat to the syntax of patterns. 125 * Section 3.17, add pat ::= !pat to the syntax of patterns. 126 We would need to take care to make clear whether 127 {{{ 128 f !x = 3 129 }}} 130 was a definition of the function "!", or of "f". (There is 131 a somewhat similar complication with n+k patterns; see the 132 end of 4.3.3.2 in the Report. However we probably do not 133 want to require parens thus 134 {{{ 135 f (!x) = 3 136 }}} 137 which are required in n+k patterns. 127 138 128 * Section 3.17.2: add new bullet 10, saying "Matching129 the pattern "!pat" against a value "v" behaves as follows:130 if v is bottom, the match diverges131 otherwise, "pat" is matched against "v".139 * Section 3.17.2: add new bullet 10, saying "Matching 140 the pattern "!pat" against a value "v" behaves as follows: 141 * if v is bottom, the match diverges 142 * otherwise, "pat" is matched against "v". 132 143 133 * Fig 3.1, 3.2, add a new case (t):144 * Fig 3.1, 3.2, add a new case (t): 134 145 {{{ 135 146 case v of { !pat > e; _ > e' } … … 137 148 }}} 138 149 139 * Section 3.12 (let expressions). In the translation box, wherever140 there is a bang right at the top of a pattern on the LHS of the141 translation rule, omit the implicit tilde that occurs at the top142 of the pattern on the RHS of the rule.150 * Section 3.12 (let expressions). In the translation box, wherever 151 there is a bang right at the top of a pattern on the LHS of the 152 translation rule, omit the implicit tilde that occurs at the top 153 of the pattern on the RHS of the rule. 143 154 144 The last point is the only delicate one, but I think it's sufficient 145 to do the job. 155 The last point is the only delicate one. If we adopt this proposal 156 we'd need to be careful about the semantics. For example, are 157 bangs ok in recursive bindings? (Yes.) And for 158 nonrecursive bindings the order of the bindings shouldn't matter.