Created
May 21, 2013 03:46
-
-
Save xenophobia/5617358 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import Prelude hiding (head, tail) | |
| import Control.Comonad | |
| data Stream a = St {head :: a, tail :: Stream a} | |
| instance Functor Stream where | |
| fmap f s = St (f (head s)) (fmap f (tail s)) | |
| instance Comonad Stream where | |
| extract = head | |
| extend f s = St (f s) (extend f (tail s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment