diff --git a/ghc/compiler/prelude/PrimOp.lhs b/ghc/compiler/prelude/PrimOp.lhs
index 71ad73378b4d4709db2f264adbcb8ef1d753d369..836e8c46a36ed54ecd038888df6cb5b1850d1051 100644
--- a/ghc/compiler/prelude/PrimOp.lhs
+++ b/ghc/compiler/prelude/PrimOp.lhs
@@ -1213,13 +1213,17 @@ primOpInfo (IndexOffForeignObjOp kind)
 
 primOpInfo (WriteOffAddrOp kind)
   = let
-	s = alphaTy; s_tv = alphaTyVar
+	s = betaTy; s_tv = betaTyVar
 
 	(str, prim_ty, _) = getPrimRepInfo kind
 	op_str = _PK_ ("write" ++ str ++ "OffAddr#")
+
+        tvs
+	  | kind == StablePtrRep = [s_tv,alphaTyVar]
+	  | otherwise	         = [s_tv]
     in
     -- NB: *Prim*Result --
-    PrimResult op_str [s_tv]
+    PrimResult op_str tvs
 	[addrPrimTy, intPrimTy, prim_ty, mkStatePrimTy s]
 	statePrimTyCon VoidRep [s]