From bece3a79ae10822b2693e0c49342223d353ecce9 Mon Sep 17 00:00:00 2001 From: sewardj Date: Fri, 19 Nov 1999 13:54:53 +0000 Subject: [PATCH] [project @ 1999-11-19 13:54:49 by sewardj] 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 | 8 ++++---- ghc/interpreter/type.c | 6 +++--- ghc/lib/hugs/Prelude.hs | 8 ++++---- ghc/rts/Assembler.c | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ghc/interpreter/lib/Prelude.hs b/ghc/interpreter/lib/Prelude.hs index 940b1ad..96aea7b 100644 --- a/ghc/interpreter/lib/Prelude.hs +++ b/ghc/interpreter/lib/Prelude.hs @@ -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 diff --git a/ghc/interpreter/type.c b/ghc/interpreter/type.c index d273849..441446b 100644 --- a/ghc/interpreter/type.c +++ b/ghc/interpreter/type.c @@ -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: diff --git a/ghc/lib/hugs/Prelude.hs b/ghc/lib/hugs/Prelude.hs index 940b1ad..96aea7b 100644 --- a/ghc/lib/hugs/Prelude.hs +++ b/ghc/lib/hugs/Prelude.hs @@ -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 diff --git a/ghc/rts/Assembler.c b/ghc/rts/Assembler.c index b5bec41..e2a4451 100644 --- a/ghc/rts/Assembler.c +++ b/ghc/rts/Assembler.c @@ -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 */ -- 1.7.10.4