mirror of
https://github.com/haskell-effectful/effectful.git
synced 2024-11-24 07:14:04 +03:00
Slight improvement to getLocation
This commit is contained in:
parent
3890b0a600
commit
ce7112a309
@ -525,11 +525,11 @@ getLocation ix (Env fork size ref _) = do
|
||||
-- specific effects for reinterpretation.
|
||||
case fork of
|
||||
NoFork -> pure $ Location i es
|
||||
Forks _ baseIx lref forks -> do
|
||||
Forks _ baseIx lref forks
|
||||
| i >= baseIx -> do
|
||||
EnvRef _ les _ <- readIORef lref
|
||||
if i >= baseIx
|
||||
then pure $ Location (i - baseIx) les
|
||||
else go es# i forks
|
||||
pure $ Location (i - baseIx) les
|
||||
| otherwise -> go es# i forks
|
||||
where
|
||||
go :: SmallMutableArray# RealWorld Any
|
||||
-> Int
|
||||
@ -537,8 +537,8 @@ getLocation ix (Env fork size ref _) = do
|
||||
-> IO Location
|
||||
go es# i = \case
|
||||
NoFork -> pure $ Location i (SmallMutableArray es#)
|
||||
Forks _ baseIx lref forks -> do
|
||||
Forks _ baseIx lref forks
|
||||
| i >= baseIx -> do
|
||||
EnvRef _ les _ <- readIORef lref
|
||||
if i >= baseIx
|
||||
then pure $ Location (i - baseIx) les
|
||||
else go es# i forks
|
||||
pure $ Location (i - baseIx) les
|
||||
| otherwise -> go es# i forks
|
||||
|
Loading…
Reference in New Issue
Block a user