[fix] Adjusted the order of NonDet+Except results in SemanticsZoo example with the order in semantics-zoo.md.

This commit is contained in:
Yamada Ryo 2024-07-17 02:50:45 +09:00
parent c7d0b45fef
commit f5482eab47
No known key found for this signature in database
GPG Key ID: AAE3C7A542B02DBF
2 changed files with 8 additions and 8 deletions

View File

@ -33,10 +33,10 @@ $ cabal run exe:SemanticsZoo
( runThrow . evalState . runCatch $ action ) = Right True
# NonDet + Except
( runThrow . runNonDet . runCatch . runChooseH $ action1 ) = Right [True,False]
( runNonDet . runThrow . runCatch . runChooseH $ action1 ) = [Right True,Right False]
( runThrow . runNonDet . runCatch . runChooseH $ action2 ) = Right [False,True]
( runThrow . runNonDet . runCatch . runChooseH $ action1 ) = Right [True,False]
( runNonDet . runThrow . runCatch . runChooseH $ action2 ) = [Right False,Right True]
( runThrow . runNonDet . runCatch . runChooseH $ action2 ) = Right [False,True]
# NonDet + Writer
( runNonDet . runTell . elaborateWriter . runChooseH $ action ) = [(3,(3,True)),(4,(4,False))]

View File

@ -52,14 +52,14 @@ nonDetPlusExcept = do
String ->
IO ()
testAllPattern action name = do
putStr $ "( runThrow . runNonDet . runCatch . runChooseH $ " <> name <> " ) = "
print . runPure $
runThrow @() . runNonDet @[] . runCatch @() . runChooseH $ action
putStr $ "( runNonDet . runThrow . runCatch . runChooseH $ " <> name <> " ) = "
print . runPure $
runNonDet @[] . runThrow @() . runCatch @() . runChooseH $ action
putStr $ "( runThrow . runNonDet . runCatch . runChooseH $ " <> name <> " ) = "
print . runPure $
runThrow @() . runNonDet @[] . runCatch @() . runChooseH $ action
testAllPattern action1 "action1"
testAllPattern action2 "action2"
@ -99,10 +99,10 @@ main = do
( runThrow . evalState . runCatch $ action ) = Right True
# NonDet + Except
( runThrow . runNonDet . runCatch . runChooseH $ action1 ) = Right [True,False]
( runNonDet . runThrow . runCatch . runChooseH $ action1 ) = [Right True,Right False]
( runThrow . runNonDet . runCatch . runChooseH $ action2 ) = Right [False,True]
( runThrow . runNonDet . runCatch . runChooseH $ action1 ) = Right [True,False]
( runNonDet . runThrow . runCatch . runChooseH $ action2 ) = [Right False,Right True]
( runThrow . runNonDet . runCatch . runChooseH $ action2 ) = Right [False,True]
# NonDet + Writer
( runNonDet . runTell . elaborateWriter . runChooseH $ action ) = [(3,(3,True)),(4,(4,False))]