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.
|
-- specific effects for reinterpretation.
|
||||||
case fork of
|
case fork of
|
||||||
NoFork -> pure $ Location i es
|
NoFork -> pure $ Location i es
|
||||||
Forks _ baseIx lref forks -> do
|
Forks _ baseIx lref forks
|
||||||
EnvRef _ les _ <- readIORef lref
|
| i >= baseIx -> do
|
||||||
if i >= baseIx
|
EnvRef _ les _ <- readIORef lref
|
||||||
then pure $ Location (i - baseIx) les
|
pure $ Location (i - baseIx) les
|
||||||
else go es# i forks
|
| otherwise -> go es# i forks
|
||||||
where
|
where
|
||||||
go :: SmallMutableArray# RealWorld Any
|
go :: SmallMutableArray# RealWorld Any
|
||||||
-> Int
|
-> Int
|
||||||
@ -537,8 +537,8 @@ getLocation ix (Env fork size ref _) = do
|
|||||||
-> IO Location
|
-> IO Location
|
||||||
go es# i = \case
|
go es# i = \case
|
||||||
NoFork -> pure $ Location i (SmallMutableArray es#)
|
NoFork -> pure $ Location i (SmallMutableArray es#)
|
||||||
Forks _ baseIx lref forks -> do
|
Forks _ baseIx lref forks
|
||||||
EnvRef _ les _ <- readIORef lref
|
| i >= baseIx -> do
|
||||||
if i >= baseIx
|
EnvRef _ les _ <- readIORef lref
|
||||||
then pure $ Location (i - baseIx) les
|
pure $ Location (i - baseIx) les
|
||||||
else go es# i forks
|
| otherwise -> go es# i forks
|
||||||
|
Loading…
Reference in New Issue
Block a user