approximate log stack in handleLogDiscard

This commit is contained in:
rhiannon morris 2024-04-06 20:03:51 +02:00
parent 567176e076
commit 7a0bc73d25
6 changed files with 33 additions and 12 deletions

View file

@ -27,7 +27,7 @@ parameters (label : String) (act : Eff Equal ())
testEq = test label $ runEqual globals act
testNeq : Test
testNeq = testThrows label (const True) $ runTC globals act $> "()"
testNeq = testThrows label (const True) $ runTC globals act $> "ok"
parameters (ctx : TyContext d n)

View file

@ -14,9 +14,10 @@ import Control.Eff
runWhnf : Eff Whnf a -> Either Error a
runWhnf act = runSTErr $ do
runEff act [handleExcept (\e => stLeft e),
handleStateSTRef !(liftST $ newSTRef 0),
handleLogDiscard]
runEff act $ with Union.(::)
[handleExcept (\e => stLeft e),
handleStateSTRef !(newSTRef' 0),
handleLogDiscardST !(newSTRef' 0)]
parameters {0 isRedex : RedexTest tm} {auto _ : CanWhnf tm isRedex} {d, n : Nat}
{auto _ : (Eq (tm d n), Show (tm d n))}

View file

@ -114,11 +114,11 @@ parameters (label : String) (act : Lazy (Eff Test ()))
{default defGlobals globals : Definitions}
testTC : Test
testTC = test label {e = Error', a = ()} $
extract $ runExcept $ runReaderAt DEFS globals act
runEff act [handleExcept (\e => Left e), handleReaderConst globals]
testTCFail : Test
testTCFail = testThrows label (const True) $
(extract $ runExcept $ runReaderAt DEFS globals act) $> "()"
runEff act [handleExcept (\e => Left e), handleReaderConst globals] $> "ok"
inferredTypeEq : TyContext d n -> (exp, got : Term d n) -> Eff Test ()

View file

@ -25,8 +25,8 @@ runEqual defs act = runSTErr $ do
runEff act $ with Union.(::)
[handleExcept (\e => stLeft e),
handleReaderConst defs,
handleStateSTRef !(liftST $ newSTRef 0),
handleLogDiscard]
handleStateSTRef !(newSTRef' 0),
handleLogDiscardST !(newSTRef' 0)]
export
runTC : Definitions -> Eff TC a -> Either Error a