Safe Haskell | Trustworthy |
---|---|
Language | Haskell98 |
These strategies are for cycle detection and construction of fixed points. Cycle detection is used wherever there are cycles in the reference graph implied by a Columbia file, or equivalently, if the file contains indefinitely large data. It ensures that reading and writing operations terminate in the presence of such data. The reconstruction of such data in a reading operation, implies that fixed points will be constructed. That way, while the reading operation terminates, it does construct indefinitely large (non-terminating) data, i.e. it reconstructs the indefinitely large data that was written.
The construction of cycles in the stream representation, is coordinated with the help of types that have non-trivial
KeyComparable
instances. These types furnish a comparison function, that can be used to compare data structure nodes,
and thus detect cycles. These cycles are reflected as reference cycles in a Columbia file. Data at such types, where
found in a cycle can be called "loop-breakers." If the data have cycles without loop breakers, the writing process
will in fact not terminate, as there is no referentially transparent way (within Haskell) to detect the cycle.
- class Monad m => StateM m where
- get' :: StateM m => m (StateOf m)
- put' :: StateM m => StateOf m -> m ()
- type CycleDetectionR m = StateT (Map Word32 Dynamic) m
- type CycleDetectionW m = StateT (Map (DynamicWithCtx KeyComparable) Word32) m
- type CycleDetectionRIO = ReaderT (IORef (Map Word32 Dynamic)) IO
- type CycleDetectionWIO = ReaderT (IORef (Map (DynamicWithCtx KeyComparable) Word32)) IO
- cycleDetect :: forall ctx m t. (MonadFix m, StateM m, StateOf m ~ Map Pointer Dynamic, HasField ctx RWCtx, Data ctx t) => PolyTraversal ctx m t
- cycleDetectW :: forall ctx m t. (StateM m, StateOf m ~ Map (DynamicWithCtx KeyComparable) Pointer, HasField ctx RWCtx, HasField ctx KeyCtx, Data ctx t) => PolyTraversalW ctx m t
- runCycleDetectionR :: Monad m => ReaderT (SeekableStream (CycleDetectionR m) Word8) (CycleDetectionR m) t -> ReaderT (SeekableStream m Word8) m t
- runCycleDetectionW :: Monad m => ReaderT (SeekableWriter (CycleDetectionW m) Word8) (CycleDetectionW m) t -> ReaderT (SeekableWriter m Word8) m t
- data Pair k v = Pair k v
- pairCtor :: Constr
- pairDataType :: DataType
Documentation
type CycleDetectionW m = StateT (Map (DynamicWithCtx KeyComparable) Word32) m Source #
type CycleDetectionWIO = ReaderT (IORef (Map (DynamicWithCtx KeyComparable) Word32)) IO Source #
cycleDetect :: forall ctx m t. (MonadFix m, StateM m, StateOf m ~ Map Pointer Dynamic, HasField ctx RWCtx, Data ctx t) => PolyTraversal ctx m t Source #
cycleDetectW :: forall ctx m t. (StateM m, StateOf m ~ Map (DynamicWithCtx KeyComparable) Pointer, HasField ctx RWCtx, HasField ctx KeyCtx, Data ctx t) => PolyTraversalW ctx m t Source #
runCycleDetectionR :: Monad m => ReaderT (SeekableStream (CycleDetectionR m) Word8) (CycleDetectionR m) t -> ReaderT (SeekableStream m Word8) m t Source #
runCycleDetectionW :: Monad m => ReaderT (SeekableWriter (CycleDetectionW m) Word8) (CycleDetectionW m) t -> ReaderT (SeekableWriter m Word8) m t Source #
A Pair
is a good data structures for associating a key and a value.
Pair k v |
(Sat (ctx (Pair k v)), Data ctx k, Data ctx v) => Data ctx (Pair k v) Source # | |
ToRep (Pair k) Source # | |
(Eq v, Eq k) => Eq (Pair k v) Source # | |
(Ord v, Ord k) => Ord (Pair k v) Source # | |
(Read v, Read k) => Read (Pair k v) Source # | |
(Show v, Show k) => Show (Pair k v) Source # | |
Ord k => KeyComparable (Pair k v) Source # | |
(Typeable * k, Typeable * v) => RW (Pair k v) Source # | |
type Rep (Pair k) v Source # | |