Skip to content

Instantly share code, notes, and snippets.

@hrajchert
Created May 13, 2019 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrajchert/4432e0153b96072250a38f5d21cf5d3b to your computer and use it in GitHub Desktop.
Save hrajchert/4432e0153b96072250a38f5d21cf5d3b to your computer and use it in GitHub Desktop.
new :: forall a r. a -> ST r (STRef r a)
read :: forall a r. STRef r a -> ST r a
write :: forall a r. a -> STRef r a -> ST r a
myDoExpr :: forall r. ST r Int
myDoExpr = do
-- ref :: STRef r Int
ref <- Ref.new 0
-- val :: Int
val <- Ref.read ref
-- ST r Int
Ref.write (val + 1) ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment