{- | reads characters from the specified output until the next result is
  complete, indicated by $ when using the maxima mode off nat; -}
getNextResultOutput :: Handle -> IO String
getNextResultOutput out = do
  b <- hIsEOF out
  if b then return "" else do
                        c <- hGetChar out
                        if c == '$' then return [] else do
                                                   r <- getNextResultOutput out
                                                   return (c : r)
getNextResultOutput :: Handle -> IO String
getNextResultOutput out = do
  b <- hIsEOF out
  if b then return "" else do
                        c <- hGetChar out
                        if c == '$' then return [] else do
                                                   r <- getNextResultOutput out
                                                   return (c : r)
getNextResultOutput out = do
  b <- hIsEOF out
  if b then return "" else do
                        c <- hGetChar out
                        if c == '$' then return [] else do
                                                   r <- getNextResultOutput out
                                                   return (c : r)