3 ms·
It should be possible to have a platform that has a mutable reference with an API like this: main = x = pf.NewRef! pf.Write! x 5 y
by lalaithion 2y ago
It should be possible to have a platform that has a mutable reference with an API like this:
main =
x = pf.NewRef!
pf.Write! x 5
y = pf.Read! x
- rtfeldman 2y agoThat's right, although the Rust equivalent of that would be more like `Future<Arc<Mutex<RefCell<T>>>>` than `Arc<Mutex<RefCell<T>>>` - so the ergonomics would be a bit different!
- greydius 2y agoHaskell: import Data.IORef main :: IO () main = do x <- newIORef (0 :: Int) writeIORef x 5 y <- readIORef x print y