Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use castPtr to avoid error on new text library #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ncaq
Copy link

@ncaq ncaq commented Oct 4, 2023

I had to deal with the useAsPtr in the new version of the text library, which seems to pass Ptr Word8 instead of Ptr UChar. It is probably safe to use castPtr for the same length, so I used it to solve the problem. I think it's safe to assume that the version that depends on the old text will just be the same with cast.

I had to deal with the `useAsPtr` in the new version of the text library, which seems to pass `Ptr Word8` instead of `Ptr UChar`.
It is probably safe to use `castPtr` for the same length, so I used it to solve the problem.
I think it's safe to assume that the version that depends on the old text will just be the same with cast.
@ncaq
Copy link
Author

ncaq commented Oct 4, 2023

In stackage it is required for compatibility from lts-21.

@@ -34,7 +34,7 @@ instance Show Transliterator where
transliterator :: Text -> IO Transliterator
transliterator spec =
useAsPtr spec $ \ptr len -> do
q <- handleError $ openTrans ptr (fromIntegral len)
q <- handleError $ openTrans (castPtr ptr) (fromIntegral len)
Copy link

Choose a reason for hiding this comment

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

have you actually verified the tests pass against this?

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.

None yet

2 participants