Skip to content

Instantly share code, notes, and snippets.

@evanrelf
Created May 6, 2024 23:14
Show Gist options
  • Save evanrelf/70c09be58970d096f5c5acaceb9f653b to your computer and use it in GitHub Desktop.
Save evanrelf/70c09be58970d096f5c5acaceb9f653b to your computer and use it in GitHub Desktop.
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