(*) :: Stream Integer -> Stream Integer -> Stream Integer
(*) (Cons x sx) (Cons y sy) = Cons (x*y) ((streamMap (* x) sy) + sx*(Cons x sx))
-instance Fractional Integer => Fractional (Stream Integer) where
+-- instance Fractional Integer => Fractional (Stream Integer) where
+instance Fractional (Stream Integer) where
(/) :: Stream Integer -> Stream Integer -> Stream Integer
- (/) (Cons x xs) (Cons y ys) = let r = streamMap (/ y) $ Cons x ((xs - r*ys))
+ (/) (Cons x xs) (Cons y ys) = let r = streamMap (`div` y) $ Cons x ((xs - r*ys))
in
r
+fibs3 :: Stream Integer
+fibs3 = x' / (streamRepeat 1 - x' - x' * x')