Skip to content

Instantly share code, notes, and snippets.

@haroldcarr
Created September 9, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haroldcarr/159e2f62cfcb478c65889c9fe566ab8f to your computer and use it in GitHub Desktop.
Save haroldcarr/159e2f62cfcb478c65889c9fe566ab8f to your computer and use it in GitHub Desktop.
monadic version
cataM' :: (Applicative m, Monad m, Traversable t)
=> (t a -> m a)
-> ((Fix t -> m a) -> (Fix t -> m a))
-> (Fix t -> m a)
cataM' f g = g ((f =<<) . traverse (cataM' f g) . unFix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment