Last active
April 11, 2017 14:04
-
-
Save gdejohn/d49cc3fe801e308ba7d3 to your computer and use it in GitHub Desktop.
Deforested tree sort, point-free one-liner
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
import Control.Applicative (liftA2) | |
import Data.List (partition) | |
import Data.List.Extra (list) | |
import Data.Tuple.Extra (both, second) | |
sort :: Ord a => [a] -> [a] | |
sort = [] `list` liftA2 (.) ((uncurry (++) .) . second . (:)) ((both sort .) . partition . (>)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment