mirror of
https://github.com/github/semantic.git
synced 2024-12-20 13:21:59 +03:00
letrec returns the address.
This commit is contained in:
parent
c392b50037
commit
4b4cea587f
@ -56,12 +56,12 @@ letrec :: ( MonadAddressable (LocationFor value) value m
|
||||
)
|
||||
=> Name
|
||||
-> m value
|
||||
-> m value
|
||||
-> m (value, Address (LocationFor value) value)
|
||||
letrec name body = do
|
||||
addr <- alloc name
|
||||
v <- localEnv (envInsert name addr) body
|
||||
assign addr v
|
||||
pure v
|
||||
pure (v, addr)
|
||||
|
||||
|
||||
-- Instances
|
||||
|
@ -118,7 +118,7 @@ loop :: ( MonadAddressable (LocationFor value) value m
|
||||
)
|
||||
=> m value
|
||||
-> m value
|
||||
loop = letrec (name "loop")
|
||||
loop = fmap fst . letrec (name "loop")
|
||||
|
||||
continue :: ( MonadAddressable (LocationFor value) value m
|
||||
, MonadEnvironment value m
|
||||
|
Loading…
Reference in New Issue
Block a user