Created
March 2, 2021 19:48
-
-
Save chris-martin/9a99e1c8a745f074968b28b523c43423 to your computer and use it in GitHub Desktop.
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
data InfiniteList a = InfiniteList a (InfiniteList a) | |
traverseForever :: Applicative m => (a -> m b) -> InfiniteList a -> m c | |
traverseForever f (InfiniteList x xs) = f x *> traverseForever f xs | |
countUpwardsFrom :: Integer -> InfiniteList Integer | |
countUpwardsFrom n = InfiniteList n (countUpwardsFrom (n + 1)) | |
forForever :: Applicative m => InfiniteList a -> (a -> m b) -> m c | |
forForever = flip traverseForever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment