Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.Utils.IntVar

Description

References to Int#.

Synopsis

Documentation

newtype IntVar# s :: UnliftedType Source #

An (unlifted) reference to an Int#.

An IntVar# s is morally a MutVar# s Int#. However, the value stored in a '@ must have a boxed runtime representation, which adds an extra pointer indirection.

IntVar# avoids this by storing the Int# inside of a MutableByteArray# containing 8 bytes.

Constructors

IntVar# (MutableByteArray# s) 

newIntVar# :: Int# -> State# s -> (# State# s, IntVar# s #) Source #

Create a new IntVar# containing an initial value.

readIntVar# :: IntVar# s -> State# s -> (# State# s, Int# #) Source #

Read the contents of an IntVar#.

writeIntVar# :: IntVar# s -> Int# -> State# s -> State# s Source #

Read the contents of an IntVar#.