mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Define an Effect instance for Env.
This commit is contained in:
parent
77fc730fe1
commit
9c5289f54b
@ -40,6 +40,12 @@ instance HFunctor (Env name addr) where
|
||||
Bind name addr m k -> Bind name addr (f m) (f . k)
|
||||
Lookup name k -> Lookup name (f . k)
|
||||
|
||||
instance Effect (Env name addr) where
|
||||
handle ctx hdl = \case
|
||||
Alloc name k -> Alloc name (hdl . (<$ ctx) . k)
|
||||
Bind name addr m k -> Bind name addr (hdl (m <$ ctx)) (hdl . fmap k)
|
||||
Lookup name k -> Lookup name (hdl . (<$ ctx) . k)
|
||||
|
||||
|
||||
data Heap addr value m k
|
||||
= Deref addr (Maybe value -> m k)
|
||||
|
Loading…
Reference in New Issue
Block a user