| Copyright | © 2018 Andy Morris |
|---|---|
| License | BSD-3-Clause |
| Maintainer | hello@andy-morris.xyz |
| Stability | experimental |
| Portability | GHC internals |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.HashCons.ConstRef
Description
Read-only references with pointer equality.
- data ConstRef a
- newConstRef :: a -> IO (ConstRef a)
- readConstRef :: ConstRef a -> a
Documentation
A read-only reference.
A ConstRef is similar to an IORef in that it has its own identity.
do a <-newConstRef() b <-newConstRef()return$a==b --False
However, unlike most types of reference, it is immutable and its value is set
at construction time. This is the reason why readConstRef does not need to
return an IO value.
readConstRef :: ConstRef a -> a Source #
Read the value of a ConstRef.