Commit 92428681 by simonpj

### [project @ 2001-07-25 13:29:07 by simonpj]

```---------------------------------
Fix a bug in the defn of "both"
---------------------------------

This bug made the bootstrapped GHC enter an absent argument.

The change is from

both Lazy (Seq k Now ds) = Seq Keep Now ds
to
both Lazy (Seq k l ds) = Seq Keep l ds

Simple, eh?  (Comments with the code.)```
parent f7341243
 ... @@ -693,11 +693,24 @@ both Err Bot = Err ... @@ -693,11 +693,24 @@ both Err Bot = Err both Err Abs = Err both Err Abs = Err both Err d = d both Err d = d both Lazy Bot = Lazy both Lazy Bot = Lazy both Lazy Abs = Lazy both Lazy Abs = Lazy both Lazy Err = Lazy both Lazy Err = Lazy both Lazy (Seq k Now ds) = Seq Keep Now ds both Lazy (Seq k l ds) = Seq Keep l ds both Lazy d = d both Lazy d = d -- Notice that the Seq case ensures that we have the -- boxed value. The equation originally said -- both (Seq k Now ds) = Seq Keep Now ds -- but it's important that the Keep is switched on even -- for a deferred demand. Otherwise a (Seq Drop Now []) -- might both'd with the result, and then we won't pass -- the boxed value. Here's an example: -- (x-1) `seq` (x+1, x) -- From the (x+1, x) we get (U*(V) `both` L), which must give S*(V) -- From (x-1) we get U(V). Combining, we must get S(V). -- If we got U*(V) from the pair, we'd end up with U(V), and that -- can be a disaster if a component of the data structure is absent. -- [Disaster = enter an absent argument.] both Eval (Seq k l ds) = Seq Keep Now ds both Eval (Seq k l ds) = Seq Keep Now ds both Eval (Call d) = Call d both Eval (Call d) = Call d ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!