Skip to content

Commit

Permalink
Fix bad merge, check against HopeSet before vectorise not after
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed Nov 22, 2024
1 parent 3c96393 commit 7c20289
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions brat/Brat/Checker/Helpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,23 +268,21 @@ getThunks :: Modey m
,Overs m UVerb
)
getThunks _ [] = pure ([], [], [])
getThunks Braty row@((src, Right ty):rest) = (eval S0 ty >>= vectorise . (src,)) >>= \case
(src, VFun Braty (ss :->> ts)) -> do
getThunks Braty row@((src, Right ty):rest) = req AskHopeSet >>= \h -> eval S0 ty >>= \case
VApp (VPar e) _ | M.member e h -> mkYield "getThunks" (S.singleton e) >> getThunks Braty row
ty -> do
(src, VFun Braty (ss :->> ts)) <- vectorise (src, ty)
(node, unders, overs, _) <- let ?my = Braty in
anext "" (Eval (end src)) (S0, Some (Zy :* S0)) ss ts
(nodes, unders', overs') <- getThunks Braty rest
pure (node:nodes, unders <> unders', overs <> overs')
(_, VFun _ _) -> err $ ExpectedThunk (showMode Braty) (showRow row) -- Shouldn't happen
(_, v) -> do
h <- req AskHopeSet
case v of
VApp (VPar e) _ | M.member e h -> mkYield "getThunks" (S.singleton e) >> getThunks Braty row
_ -> typeErr $ "Force called on non-thunk: " ++ show v
-- TODO we probably want to check against the HopeSet here too, good to refactor+common-up somehow
getThunks Kerny row@((src, Right ty):rest) = (eval S0 ty >>= vectorise . (src,)) >>= \case
(src, VFun Kerny (ss :->> ts)) -> do
(node, unders, overs, _) <- let ?my = Kerny in anext "" (Splice (end src)) (S0, Some (Zy :* S0)) ss ts
(nodes, unders', overs') <- getThunks Kerny rest
pure (node:nodes, unders <> unders', overs <> overs')
-- These shouldn't happen (as this is return value of vectorise - can we return something more specific?)
(_, VFun _ _) -> err $ ExpectedThunk (showMode Kerny) (showRow row)
v -> typeErr $ "Force called on non-(kernel)-thunk: " ++ show v
getThunks Braty ((src, Left (Star args)):rest) = do
Expand Down

0 comments on commit 7c20289

Please sign in to comment.