packages feed

tilia-0.1.0.0: corpora/vendored/other/cpp/import-in-one-branch-declarations-in-the-other.hs

{-# LANGUAGE CPP #-}
module Terminal.Sort where

import Data.Char (toLower)

#if MIN_VERSION_base(4,8,0)
import Data.List (sortOn)
#else
sortOn   ::  Ord b => (a -> b) -> [a] -> [a]
sortOn _  =  id
#endif

byName :: [String] -> [String]
byName  =  sortOn (fmap toLower)

byLength :: [String] -> [String]
byLength  =  sortOn length