Skip to content

Commit

Permalink
fixing abort index
Browse files Browse the repository at this point in the history
  • Loading branch information
sfultong committed Aug 6, 2024
1 parent fb39132 commit f3ceaa8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Telomare/Possible.hs
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ abortStep handleOther =
BasicFW (SetEnvSF a@(AbortEE (AbortedF _))) -> a
FillFunction a@(AbortEE (AbortedF _)) _ -> a
GateSwitch _ _ a@(AbortEE (AbortedF _)) -> a
FillFunction (AbortEE AbortF) (BasicEE ZeroSF) -> stuckEE . DeferSF i . basicEE $ EnvSF where
i = toEnum (-1)
FillFunction (AbortEE AbortF) (BasicEE ZeroSF) -> deferB abortInd . basicEE $ EnvSF
-- BasicFW (FillFunction (AbortEE AbortF) (TwoEE AnyPF)) -> embed . ThreeFW . AbortedF $ AbortAny
FillFunction (AbortEE AbortF) e@(BasicEE (PairSF _ _)) -> abortEE $ AbortedF m where
m = cata truncF e
Expand All @@ -486,8 +485,7 @@ abortStepM handleOther x = f x where
BasicFW (SetEnvSF a@(AbortEE (AbortedF _))) -> pure a
FillFunction a@(AbortEE (AbortedF _)) _ -> pure a
GateSwitch _ _ a@(AbortEE (AbortedF _)) -> pure a
FillFunction (AbortEE AbortF) (BasicEE ZeroSF) -> pure . stuckEE . DeferSF i . basicEE $ EnvSF where
i = toEnum (-1)
FillFunction (AbortEE AbortF) (BasicEE ZeroSF) -> pure . deferB abortInd . basicEE $ EnvSF
FillFunction (AbortEE AbortF) e@(BasicEE (PairSF _ _)) -> pure . abortEE $ AbortedF m where
m = cata truncF e
truncF = \case
Expand Down Expand Up @@ -528,8 +526,8 @@ instance PrettyPrintable1 (StrictAccum SizedRecursion) where
showP1 (StrictAccum _ x) = showP x

-- list of defer indexes for functions generated during eval. Need to be unique (grammar under defer n should always be the same)
[twiddleInd, unsizedStepMEInd, unsizedStepMTInd, unsizedStepMa, unsizedStepMrfa, unsizedStepMrfb, unsizedStepMw, removeRefinementWrappersTC]
= take 8 [-1, -2 ..]
[twiddleInd, unsizedStepMEInd, unsizedStepMTInd, unsizedStepMa, unsizedStepMrfa, unsizedStepMrfb, unsizedStepMw, removeRefinementWrappersTC, abortInd]
= take 9 [-1, -2 ..]

deferB :: (Base g ~ f, StuckBase f, Recursive g, Corecursive g) => Int -> g -> g
deferB n = stuckEE . DeferSF (toEnum n)
Expand Down

0 comments on commit f3ceaa8

Please sign in to comment.