Commit 92ecbddd authored by Bas Lijnse's avatar Bas Lijnse

Fixed what I think is a bug in ggen. I got weird infinite recursions in...

Fixed what I think is a bug in ggen. I got weird infinite recursions in derived functions and I believe they were caused by an incorrect definition of EITHER
parent 96012cec
......@@ -69,7 +69,8 @@ ggen{|PAIR|} f g n rnd
ggen{|EITHER|} f g n rnd
# (r1,rnd) = split rnd
(r2,rnd) = split rnd
= Merge n rnd (f n r1) (g (n+1) r2)
= Merge n rnd (f n r1) (g n r2)
//= Merge n rnd (f n r1) (g (n+1) r2)
where
Merge :: Int RandomStream [a] [b] -> [EITHER a b] // Correct, strict in none of the lists!
Merge n [i:r] as bs
......@@ -88,7 +89,8 @@ where
| isOdd i
= [LEFT a, RIGHT b:Merge r as bs]
= [RIGHT b, LEFT a:Merge r as bs]
*//* = Merge (isOdd (hd rnd)) (f r1) (g r2)
*/
/* = Merge (isOdd (hd rnd)) (f r1) (g r2)
where
Merge :: Bool [a] [b] -> [EITHER a b]
Merge r as bs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment