+\begin{code}
+rnCoreExpr (UfType ty)
+ = rnHsType (text "unfolding type") ty `thenRn` \ (ty', fvs) ->
+ returnRn (UfType ty', fvs)
+
+rnCoreExpr (UfVar v)
+ = lookupOccRn v `thenRn` \ v' ->
+ returnRn (UfVar v', unitFV v')
+
+rnCoreExpr (UfCon con args)
+ = rnUfCon con `thenRn` \ (con', fvs1) ->
+ mapFvRn rnCoreExpr args `thenRn` \ (args', fvs2) ->
+ returnRn (UfCon con' args', fvs1 `plusFV` fvs2)
+
+rnCoreExpr (UfTuple con args)
+ = lookupOccRn con `thenRn` \ con' ->
+ mapFvRn rnCoreExpr args `thenRn` \ (args', fvs) ->
+ returnRn (UfTuple con' args', fvs `addOneFV` con')
+
+rnCoreExpr (UfApp fun arg)
+ = rnCoreExpr fun `thenRn` \ (fun', fv1) ->
+ rnCoreExpr arg `thenRn` \ (arg', fv2) ->
+ returnRn (UfApp fun' arg', fv1 `plusFV` fv2)
+
+rnCoreExpr (UfCase scrut bndr alts)
+ = rnCoreExpr scrut `thenRn` \ (scrut', fvs1) ->
+ bindCoreLocalFVRn bndr ( \ bndr' ->
+ mapFvRn rnCoreAlt alts `thenRn` \ (alts', fvs2) ->
+ returnRn (UfCase scrut' bndr' alts', fvs2)
+ ) `thenRn` \ (case', fvs3) ->
+ returnRn (case', fvs1 `plusFV` fvs3)
+
+rnCoreExpr (UfNote note expr)
+ = rnNote note `thenRn` \ (note', fvs1) ->
+ rnCoreExpr expr `thenRn` \ (expr', fvs2) ->
+ returnRn (UfNote note' expr', fvs1 `plusFV` fvs2)
+
+rnCoreExpr (UfLam bndr body)
+ = rnCoreBndr bndr $ \ bndr' ->
+ rnCoreExpr body `thenRn` \ (body', fvs) ->
+ returnRn (UfLam bndr' body', fvs)
+
+rnCoreExpr (UfLet (UfNonRec bndr rhs) body)
+ = rnCoreExpr rhs `thenRn` \ (rhs', fvs1) ->
+ rnCoreBndr bndr ( \ bndr' ->
+ rnCoreExpr body `thenRn` \ (body', fvs2) ->
+ returnRn (UfLet (UfNonRec bndr' rhs') body', fvs2)
+ ) `thenRn` \ (result, fvs3) ->
+ returnRn (result, fvs1 `plusFV` fvs3)
+
+rnCoreExpr (UfLet (UfRec pairs) body)
+ = rnCoreBndrs bndrs $ \ bndrs' ->
+ mapFvRn rnCoreExpr rhss `thenRn` \ (rhss', fvs1) ->
+ rnCoreExpr body `thenRn` \ (body', fvs2) ->
+ returnRn (UfLet (UfRec (bndrs' `zip` rhss')) body', fvs1 `plusFV` fvs2)