mirror of
https://github.com/github/semantic.git
synced 2024-12-27 00:44:57 +03:00
Add a handler for Precise addresses.
This commit is contained in:
parent
40eb2201da
commit
dfea90e16b
@ -27,6 +27,12 @@ data Allocator location value return where
|
||||
Deref :: Address location value -> Allocator location value value
|
||||
|
||||
|
||||
runAllocatorPrecise :: Members '[Fresh, Resumable (AddressError Precise value), State (Heap Precise Latest value)] effects => Evaluator Precise value (Allocator Precise value ': effects) a -> Evaluator Precise value effects a
|
||||
runAllocatorPrecise = relay pure (\ eff yield -> case eff of
|
||||
Alloc _ -> Address . Precise <$> fresh >>= yield
|
||||
Deref addr -> lookupHeap addr >>= maybeM (throwAddressError (UnallocatedAddress addr)) >>= maybeM (throwAddressError (UninitializedAddress addr)) . getLast . unLatest >>= yield)
|
||||
|
||||
|
||||
-- | Defines 'alloc'ation and 'deref'erencing of 'Address'es in a Heap.
|
||||
class (Ord location, Show location) => Addressable location effects where
|
||||
derefCell :: Address location value -> Cell location value -> Evaluator location value effects (Maybe value)
|
||||
|
Loading…
Reference in New Issue
Block a user