rToSymbol :: Algebraic -> [(Algebraic, Rational)] -> Symbol
-- ^ changes variables to symbols - this function should be applied after having
-- made all substitutions before - danger danger danger danger !!!
varToSymbol a srules | a `elem` keys = Symbol (Just value, Alg (show value))
                     | isNumber a    = Symbol (Just rat,   a)
                     | otherwise     = Symbol (Nothing   , a)
                     where Alg a_ = a
                           rat = read a_::Rational
                           keys = map fst srules
                           aValues = map snd $ filter (\x -> fst x == a) srules
                           (value:[]) = aValues -- with pattern matching ??


varToSymbol :: Algebraic -> [(Algebraic, Rational)] -> Symbol
varToSymbol a srules | a `elem` keys = Symbol (Just value, Alg (show value))
                     | isNumber a    = Symbol (Just rat,   a)
                     | otherwise     = Symbol (Nothing   , a)
                     where Alg a_ = a
                           rat = read a_::Rational
                           keys = map fst srules
                           aValues = map snd $ filter (\x -> fst x == a) srules
                           (value:[]) = aValues -- with pattern matching ??
varToSymbol a srules | a `elem` keys = Symbol (Just value, Alg (show value))
                     | isNumber a    = Symbol (Just rat,   a)
                     | otherwise     = Symbol (Nothing   , a)
                     where Alg a_ = a
                           rat = read a_::Rational
                           keys = map fst srules
                           aValues = map snd $ filter (\x -> fst x == a) srules
                           (value:[]) = aValues -- with pattern matching ??