Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Last active December 17, 2015 04:18
Show Gist options
  • Save puffnfresh/5549221 to your computer and use it in GitHub Desktop.
Save puffnfresh/5549221 to your computer and use it in GitHub Desktop.
import Data.Foldable
import Data.Monoid
pipeline :: [a -> a] -> a -> a
pipeline = appEndo . getDual . foldMap (Dual . Endo)
main = print $ pipeline [(+1), (*10)] 100
@puffnfresh
Copy link
Author

@mergeconflict that is actually a great way of showing that a monad is a monoid in the category of endofunctors. Thanks.

@mergeconflict
Copy link

Yup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment