Skip to content

Conversation

@sjakobi
Copy link
Member

@sjakobi sjakobi commented Oct 2, 2025

...and a warning regarding the import of liftA2

Fixes #505


TODO:

  • Figure out what to do about the use of lengthM inside CHECK_BOUNDS and CHECK_LE checks

@sjakobi sjakobi changed the title Adress deprecation warnings Address deprecation warnings Oct 2, 2025
@sjakobi sjakobi force-pushed the sjakobi/issue505 branch 2 times, most recently from 3d07305 to 498e663 Compare October 5, 2025 11:55
...and a warning regarding the import of liftA2

Fixes #505
@sjakobi sjakobi marked this pull request as ready for review October 5, 2025 12:07
Comment on lines -161 to +175
lengthM :: MArray s a -> Int
lengthM mary = I# (sizeofSmallMutableArray# (unMArray mary))
lengthM :: MArray s a -> ST s Int
lengthM (MArray ary) = ST $ \s ->
case getSizeofSmallMutableArray# ary s of
(# s', n #) -> (# s', I# n #)
{-# INLINE lengthM #-}

#if defined(ASSERTS)
-- | Unsafe. Only for use in the @CHECK_*@ pragmas.
unsafeLengthM :: MArray s a -> Int
unsafeLengthM mary = I# (sizeofSmallMutableArray# (unMArray mary))
{-# INLINE unsafeLengthM #-}
#endif

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have preferred to completely remove any use of sizeofSmallMutableArray#, but I haven't been able to come up with a good solution that would allow us to keep the bounds CHECKs.

@sjakobi sjakobi requested a review from treeowl October 5, 2025 12:10
@sjakobi sjakobi merged commit c251abf into master Oct 9, 2025
9 checks passed
@sjakobi sjakobi deleted the sjakobi/issue505 branch October 9, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation warnings

1 participant