From 0ee67caa13dc6a0810fa6938b56fba579c67b847 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Mon, 22 Dec 2014 22:05:36 +0530
Subject: [PATCH] bug fix in Fractional instance

---
 hw6/Fibonacci.hs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw6/Fibonacci.hs b/hw6/Fibonacci.hs
index e7b3f59..15b563b 100644
--- a/hw6/Fibonacci.hs
+++ b/hw6/Fibonacci.hs
@@ -88,8 +88,11 @@ instance Num (Stream Integer) where
   (*) :: 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')
-- 
2.45.2