[project @ 1999-11-19 13:54:49 by sewardj]
authorsewardj <unknown>
Fri, 19 Nov 1999 13:54:53 +0000 (13:54 +0000)
committersewardj <unknown>
Fri, 19 Nov 1999 13:54:53 +0000 (13:54 +0000)
Make Ref only be parameterised by the type of the mutable value,
rather than by that *and* the type of the state token.

ghc/interpreter/lib/Prelude.hs
ghc/interpreter/type.c
ghc/lib/hugs/Prelude.hs
ghc/rts/Assembler.c

index 940b1ad..96aea7b 100644 (file)
@@ -1889,15 +1889,15 @@ freeStablePtr    = primFreeStablePtr
 data PrimArray              a -- immutable arrays with Int indices
 data PrimByteArray
 
-data Ref                  s a -- mutable variables
+data Ref                    a -- mutable variables
 data PrimMutableArray     s a -- mutable arrays with Int indices
 data PrimMutableByteArray s
 
-newRef   :: a -> ST s (Ref s a)
+newRef   :: a -> IO (Ref a)
 newRef    = primNewRef
-readRef  :: Ref s a -> ST s a
+readRef  :: Ref a -> IO a
 readRef   = primReadRef
-writeRef :: Ref s a -> a -> ST s ()
+writeRef :: Ref a -> a -> IO ()
 writeRef  = primWriteRef
 
 
index d273849..441446b 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: type.c,v $
- * $Revision: 1.13 $
- * $Date: 1999/11/17 16:57:50 $
+ * $Revision: 1.14 $
+ * $Date: 1999/11/19 13:54:49 $
  * ------------------------------------------------------------------------*/
 
 #include "prelude.h"
@@ -2579,7 +2579,7 @@ Char k; {
     case BARR_REP:
             return typePrimByteArray;
     case REF_REP:
-            return ap2(typeRef,mkStateVar(),mkAlphaVar());                  
+            return ap(typeRef,mkAlphaVar());
     case MUTARR_REP:
             return ap2(typePrimMutableArray,mkStateVar(),mkAlphaVar());     
     case MUTBARR_REP:
index 940b1ad..96aea7b 100644 (file)
@@ -1889,15 +1889,15 @@ freeStablePtr    = primFreeStablePtr
 data PrimArray              a -- immutable arrays with Int indices
 data PrimByteArray
 
-data Ref                  s a -- mutable variables
+data Ref                    a -- mutable variables
 data PrimMutableArray     s a -- mutable arrays with Int indices
 data PrimMutableByteArray s
 
-newRef   :: a -> ST s (Ref s a)
+newRef   :: a -> IO (Ref a)
 newRef    = primNewRef
-readRef  :: Ref s a -> ST s a
+readRef  :: Ref a -> IO a
 readRef   = primReadRef
-writeRef :: Ref s a -> a -> ST s ()
+writeRef :: Ref a -> a -> IO ()
 writeRef  = primWriteRef
 
 
index b5bec41..e2a4451 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Assembler.c,v $
- * $Revision: 1.16 $
- * $Date: 1999/11/18 12:10:24 $
+ * $Revision: 1.17 $
+ * $Date: 1999/11/19 13:54:53 $
  *
  * This module provides functions to construct BCOs and other closures
  * required by the bytecode compiler.
@@ -1323,9 +1323,9 @@ const AsmPrim asmPrimOps[] = {
     , { "primIsIEEEDouble",          "",   "B",  MONAD_Id, i_PRIMOP1, i_isIEEEDouble }
 
     /* Ref operations */
-    , { "primNewRef",                "a",  "R",  MONAD_ST, i_PRIMOP2, i_newRef }
-    , { "primWriteRef",              "Ra", "",   MONAD_ST, i_PRIMOP2, i_writeRef }
-    , { "primReadRef",               "R",  "a",  MONAD_ST, i_PRIMOP2, i_readRef }
+    , { "primNewRef",                "a",  "R",  MONAD_IO, i_PRIMOP2, i_newRef }
+    , { "primWriteRef",              "Ra", "",   MONAD_IO, i_PRIMOP2, i_writeRef }
+    , { "primReadRef",               "R",  "a",  MONAD_IO, i_PRIMOP2, i_readRef }
     , { "primSameRef",               "RR", "B",  MONAD_Id, i_PRIMOP2, i_sameRef }
 
     /* PrimArray operations */