Implementing the ruler function using `streamInterleave`
问题 I am doing the homework of CIS 194. The problem is to implement the ruler function by using streamInterleave . The code looks like data Stream a = Cons a (Stream a) streamRepeat :: a -> Stream a streamRepeat x = Cons x (streamRepeat x) streamMap :: (a -> b) -> Stream a -> Stream b streamMap f (Cons x xs) = Cons (f x) (streamMap f xs) streamInterleave :: Stream a -> Stream a -> Stream a streamInterleave (Cons x xs) ys = Cons x (streamInterleave ys xs) ruler :: Stream Integer ruler =