convertTerm :: M -> Term
convertTerm m =
  case m of
  M [] (R (RVar f (A bindings _)) args)
    | not (null args) -> App f (zipWith
                                 convertObj
                                 (map (bindTy . convertHypothesis) bindings)
                                 args)
  M [] (R (RVar x _) []) -> Var x
  _ -> error $ concat ["Malformed term: ", show m]
convertTerm :: M -> Term
convertTerm m =
  case m of
  M [] (R (RVar f (A bindings _)) args)
    | not (null args) -> App f (zipWith
                                 convertObj
                                 (map (bindTy . convertHypothesis) bindings)
                                 args)
  M [] (R (RVar x _) []) -> Var x
  _ -> error $ concat ["Malformed term: ", show m]
convertTerm m =
  case m of
  M [] (R (RVar f (A bindings _)) args)
    | not (null args) -> App f (zipWith
                                 convertObj
                                 (map (bindTy . convertHypothesis) bindings)
                                 args)
  M [] (R (RVar x _) []) -> Var x
  _ -> error $ concat ["Malformed term: ", show m]