-- http://www.codewars.com/kata/5517fcb0236c8826940003c9
module Codewars.Kata.SumFracts where
import Data.Ratio
import Data.Tuple

sumFracts :: [(Integer, Integer)] -> Maybe String
sumFracts = display . sum . map (uncurry (%)) where
  display 0 = Nothing
  display r = Just $ show n ++ (if d==1 then "" else ' ' : show d) where
    n = numerator   r
    d = denominator r