Skip to content

Instantly share code, notes, and snippets.

@MiyamonY
Created March 2, 2015 15:44
Show Gist options
  • Save MiyamonY/4a84ecedf7d8d0b47d25 to your computer and use it in GitHub Desktop.
Save MiyamonY/4a84ecedf7d8d0b47d25 to your computer and use it in GitHub Desktop.
import Data.Monoid
-- class Monoid m where
-- mempty :: m
-- mappend :: m -> m -> m
-- mconcat = foldr mappend mempty
-- instance Monoid [a] where
-- mepmty = []
-- mappend = (++)
lengthCompare :: String -> String -> Ordering
-- lengthCompare x y = let a = length x `compare` length y
-- b = x `compare` y
-- in if a == EQ then b else a
lengthCompare x y =
(length x `compare` length y) `mappend`
(vowels x `compare` vowels) `mappend`
(x `compare` y)
where vowels x = length . filter (`elem` "aiueo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment