1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

💄: $ for effect handler.

This commit is contained in:
Rob Rix 2018-05-31 08:51:17 -04:00
parent b491750f94
commit ffd1e3e3f8

View File

@ -113,9 +113,9 @@ data Store address value return where
Deref :: address -> Store address value value
runStore :: (Addressable address effects, Member (Resumable (AddressError address value)) effects, Member (State (Heap address (Cell address) value)) effects) => Evaluator address value (Store address value ': effects) a -> Evaluator address value effects a
runStore = interpret (\ eff -> case eff of
runStore = interpret $ \ eff -> case eff of
Alloc name -> allocCell name
Deref addr -> heapLookup addr <$> get >>= maybeM (throwResumable (UnallocatedAddress addr)) >>= derefCell addr >>= maybeM (throwResumable (UninitializedAddress addr)))
Deref addr -> heapLookup addr <$> get >>= maybeM (throwResumable (UnallocatedAddress addr)) >>= derefCell addr >>= maybeM (throwResumable (UninitializedAddress addr))
data AddressError address value resume where