1
1
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:
Rob Rix 2018-03-14 15:06:40 -04:00
parent c392b50037
commit 4b4cea587f
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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