Created
May 6, 2024 23:14
-
-
Save evanrelf/70c09be58970d096f5c5acaceb9f653b 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
module Repeatedly where | |
import Data.Foldable (foldl', foldlM) | |
repeatedly :: (Foldable t) => (a -> b -> b) -> (t a -> b -> b) | |
repeatedly = flip . foldl' . flip | |
repeatedlyM :: (Foldable t, Monad m) => (a -> b -> m b) -> (t a -> b -> m b) | |
repeatedlyM = flip . foldlM . flip | |
-- https://www.youtube.com/watch?v=pQThkisvsVs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment