Repository navigation
Conversation
ynishiza
force-pushed
the
test/strictness-state
branch
from
October 11, 2026 10:22
081bda7 to
94ca230
Compare
ynishiza
force-pushed
the
test/strictness-state
branch
from
October 11, 2026 10:52
94ca230 to
83eb097
Compare
ynishiza
commented
Oct 11, 2026
Comment on lines
45
to
+46
| data BaseMonad | ||
| = forall m. (Typeable m, Monad m) => LazyBaseMonad (forall a. m a -> IO a) | ||
| | forall m. (Typeable m, Monad m) => StrictBaseMonad (forall a. m a -> IO a) | ||
| = forall m. (Typeable m, Monad m) => BaseMonad (forall a. m a -> IO a) |
Contributor
Author
There was a problem hiding this comment.
I simplified this to just BaseMonad since there are different nuances of strictness which can get complicated to categorize.
Instead, if there is a difference in the behavior depending on the underlying monad, I opted to just check the actual monad type directly and explain with a comment, as done in one of the tests here.
Please let me know if you have any thoughts.
Contributor
Author
There was a problem hiding this comment.
Just the strictness assertions moved out of the writer tests
Comment on lines
+204
to
+220
| -- In general, the computations are lazy since this is the Lazy State. | ||
| -- | ||
| -- However, one exception is modify', which enforces strictness on the state value. | ||
| -- Thus, modify' will bottom for monads which are strict in the underlying sequencing. | ||
| -- i.e. Solo and IO | ||
| -- | ||
| -- In particular, note that Identity is lazy whereas Solo is strict: | ||
| -- | ||
| -- m >>= k = k (runIdentity m) lazy runIdentity | ||
| -- MkSolo x >>= k = k x strict pattern match | ||
| -- | ||
| let expected = (baseMonadName m == "Solo" || baseMonadName m == "IO") && isBottom (f (snd (x 0))) | ||
| in shouldBeBottomIO expected $ withBaseMonad m $ flip Lazy.runStateT 0 $ do | ||
| p <- Lazy.StateT $ return . x | ||
| q <- Lazy.get | ||
|
|
||
| Lazy.modify' f -- may throw depending on the underlying monad. See above. |
Contributor
Author
There was a problem hiding this comment.
The example mentioned above.
ynishiza
force-pushed
the
test/strictness-state
branch
from
October 11, 2026 10:56
83eb097 to
1781938
Compare
ynishiza
marked this pull request as ready for review
October 11, 2026 10:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests for the Lazy|Strict State transformer.
The approach is analogous to the Writer tests in #127.
evalStateT,execStateT,mapStateT,withStateT,put,modify,modify',modifyMgetsfmap,<*>,liftA2,>>=(same as the Writer tests)liftListen,liftPass, since the behavior differs for these, as it did also in the Writer transformers