atic
  :: SFactors Integer m
  -> Mod m   -- ^ a
  -> Mod m   -- ^ b
  -> Mod m   -- ^ c
  -> [Mod m] -- ^ list of x
solveQuadratic sm a b c = case proofFromSFactors sm of
  Sub Dict ->
    map fromInteger
    $ fst
    $ combine
    $ map (\(p, n) -> (solveQuadraticPrimePower a' b' c' p n, unPrime p ^ n))
    $ unSFactors sm
  where
    a' = toInteger $ unMod a
    b' = toInteger $ unMod b
    c' = toInteger $ unMod c

    combine :: [([Integer], Integer)] -> ([Integer], Integer)
    combine = foldl
      (\(xs, xm) (ys, ym) -> ([ fst $ fromJust $ chinese (x, xm) (y, ym) | x <- xs, y <- ys ], xm * ym))
      ([0], 1)

solveQua
solveQuadratic
  :: SFactors Integer m
  -> Mod m   -- ^ a
  -> Mod m   -- ^ b
  -> Mod m   -- ^ c
  -> [Mod m]
solveQuadratic sm a b c = case proofFromSFactors sm of
  Sub Dict ->
    map fromInteger
    $ fst
    $ combine
    $ map (\(p, n) -> (solveQuadraticPrimePower a' b' c' p n, unPrime p ^ n))
    $ unSFactors sm
  where
    a' = toInteger $ unMod a
    b' = toInteger $ unMod b
    c' = toInteger $ unMod c

    combine :: [([Integer], Integer)] -> ([Integer], Integer)
    combine = foldl
      (\(xs, xm) (ys, ym) -> ([ fst $ fromJust $ chinese (x, xm) (y, ym) | x <- xs, y <- ys ], xm * ym))
      ([0], 1)
solveQuadratic sm a b c = case proofFromSFactors sm of
  Sub Dict ->
    map fromInteger
    $ fst
    $ combine
    $ map (\(p, n) -> (solveQuadraticPrimePower a' b' c' p n, unPrime p ^ n))
    $ unSFactors sm
  where
    a' = toInteger $ unMod a
    b' = toInteger $ unMod b
    c' = toInteger $ unMod c

    combine :: [([Integer], Integer)] -> ([Integer], Integer)
    combine = foldl
      (\(xs, xm) (ys, ym) -> ([ fst $ fromJust $ chinese (x, xm) (y, ym) | x <- xs, y <- ys ], xm * ym))
      ([0], 1)