Created
April 21, 2018 17:27
-
-
Save joneshf/a5d6269efd444eee40e6456a7530effb to your computer and use it in GitHub Desktop.
codata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
class Codata --where | |
data Stream a | |
= Head a (Codata => Stream a) | |
from :: Int -> Stream Int | |
from x = Head x (from (x + 1)) | |
-- mapStream :: forall a b. (a -> b) -> Stream a -> Stream b | |
mapStream f (Head x xs) = Head (f x) (mapStream f xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment