Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Stream a = Cons a (Stream a)
- instance Show a => Show (Stream a) where
- show = take 20 . streamToList
- streamToList :: Stream a -> [a]
- streamToList (Cons x xs) = [x] ++ streamToList xs
- -- generates a stream containing infinitely many copies of the
- -- given elemen
- streamRepeat :: a -> Stream a
- streamRepeat x = Cons x $ streamRepeat x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement