Skip to content

Commit

Permalink
Fiddling with ref'write conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Oct 17, 2024
1 parent 64348e9 commit aaf43bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions unison-runtime/src/Unison/Runtime/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,9 +1095,7 @@ ref'read =

ref'write :: SuperNormal Symbol
ref'write =
binop0 1 $ \[ref, val, unit] ->
TLetD unit BX (TCon Ty.unitRef 0 [])
$ (TPrm WREF [ref, val])
binop0 0 $ \[ref, val] -> (TPrm WREF [ref, val])

seek'handle :: ForeignOp
seek'handle instr =
Expand Down
3 changes: 0 additions & 3 deletions unison-runtime/src/Unison/Runtime/Foreign.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ instance BuiltinForeign Value where foreignRef = Tagged Ty.valueRef

instance BuiltinForeign TimeSpec where foreignRef = Tagged Ty.timeSpecRef

-- TODO: investigate this
instance BuiltinForeign (IORef closure) where foreignRef = Tagged Ty.refRef

data HashAlgorithm where
-- Reference is a reference to the hash algorithm
HashAlgorithm :: (Hash.HashAlgorithm a) => Reference -> a -> HashAlgorithm
Expand Down
4 changes: 4 additions & 0 deletions unison-runtime/src/Unison/Runtime/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ module Unison.Runtime.Stack
where

import Control.Monad.Primitive
import Data.IORef (IORef)
import Data.Tagged (Tagged (..))
import Data.Word
import GHC.Exts as L (IsList (..))
import Unison.Prelude
Expand Down Expand Up @@ -159,6 +161,8 @@ instance Ord K where
newtype Closure = Closure {unClosure :: (GClosure (RComb Closure))}
deriving stock (Show, Eq, Ord)

instance BuiltinForeign (IORef Closure) where foreignRef = Tagged Ty.refRef

type IxClosure = GClosure CombIx

data GClosure comb
Expand Down

0 comments on commit aaf43bd

Please sign in to comment.