resugarMatch :: Resugarable a => TyVar -> (Maybe Var, a) -> (Maybe Var, a)
             -> DesugarM RMatch
resugarMatch dataty (v1, e1) (v2, e2)
    = do decls <- getDecls
         e1' <- resugarM e1
         e2' <- resugarM e2
         case getTyDeclByName decls dataty of
           Just decl ->
               return (RMatch [ ((conL decl), v1, e1')
                              , ((conR decl), v2, e2') ] )
           Nothing -> resugarError ("Unknown data type: " ++ show dataty)
resugarMatch :: Resugarable a => TyVar -> (Maybe Var, a) -> (Maybe Var, a)
             -> DesugarM RMatch
resugarMatch dataty (v1, e1) (v2, e2)
    = do decls <- getDecls
         e1' <- resugarM e1
         e2' <- resugarM e2
         case getTyDeclByName decls dataty of
           Just decl ->
               return (RMatch [ ((conL decl), v1, e1')
                              , ((conR decl), v2, e2') ] )
           Nothing -> resugarError ("Unknown data type: " ++ show dataty)
resugarMatch dataty (v1, e1) (v2, e2)
    = do decls <- getDecls
         e1' <- resugarM e1
         e2' <- resugarM e2
         case getTyDeclByName decls dataty of
           Just decl ->
               return (RMatch [ ((conL decl), v1, e1')
                              , ((conR decl), v2, e2') ] )
           Nothing -> resugarError ("Unknown data type: " ++ show dataty)