Re:Turn O(n^2) reverse into O(n)
by djipko on Monday December 16, 2013 @04:11AM
(#6913622)
Nice explanation. I'm surprised that no one so far mentioned a cool trick for getting around this using a different way to define mappend as function composition, to make sure ++ is applied in the right order, since it's from LYAH (scroll to end of the linked chapter):
http://learnyouahaskell.com/for-a-few-monads-more#writer