minDegs ((x,deg):xs) = fst $ foldr mins ([x],deg) xs 
  where
    mins :: (Int,Int) -> ([Int],Int) -> ([Int],Int)
    mins (v, m) (vs, n) = 
      case compare m n of
        GT -> (vs, n)
        EQ -> (v : vs, n)
        LT -> ([v], m)
minDegs ((x,deg):xs) = fst $ foldr mins ([x],deg) xs 
  where
    mins :: (Int,Int) -> ([Int],Int) -> ([Int],Int)
    mins (v, m) (vs, n) = 
      case compare m n of
        GT -> (vs, n)
        EQ -> (v : vs, n)
        LT -> ([v], m)
minDegs ((x,deg):xs) = fst $ foldr mins ([x],deg) xs 
  where
    mins :: (Int,Int) -> ([Int],Int) -> ([Int],Int)
    mins (v, m) (vs, n) = 
      case compare m n of
        GT -> (vs, n)
        EQ -> (v : vs, n)
        LT -> ([v], m)