Go to the first, previous, next, last section, table of contents.
This subsection defines some types which, while they aren't quite
primitive because we can define them in Haskell, are very nearly so.
They define constructors which pair a primitive state with a value of
each primitive type. They are required to express the result type of
the primitive operations in the state monad.
data StateAndPtr# s elt = StateAndPtr# (State# s) elt
data StateAndChar# s = StateAndChar# (State# s) Char#
data StateAndInt# s = StateAndInt# (State# s) Int#
data StateAndWord# s = StateAndWord# (State# s) Word#
data StateAndFloat# s = StateAndFloat# (State# s) Float#
data StateAndDouble# s = StateAndDouble# (State# s) Double#
data StateAndAddr# s = StateAndAddr# (State# s) Addr#
data StateAndStablePtr# s a = StateAndStablePtr# (State# s) (StablePtr# a)
data StateAndForeignObj# s = StateAndForeignObj# (State# s) ForeignObj#
data StateAndSynchVar# s a = StateAndSynchVar# (State# s) (SynchVar# a)
data StateAndArray# s elt = StateAndArray# (State# s) (Array# elt)
data StateAndMutableArray# s elt = StateAndMutableArray# (State# s) (MutableArray# s elt)
data StateAndByteArray# s = StateAndByteArray# (State# s) ByteArray#
data StateAndMutableByteArray# s = StateAndMutableByteArray# (State# s) (MutableByteArray# s)
Hideous.
Go to the first, previous, next, last section, table of contents.