Skip to content

Remove unsafeCoerce from Data.constant#73

Merged
dmjio merged 1 commit into
masterfrom
remove-unsafe-coerce
Jun 20, 2026
Merged

Remove unsafeCoerce from Data.constant#73
dmjio merged 1 commit into
masterfrom
remove-unsafe-coerce

Conversation

@dmjio

@dmjio dmjio commented Jun 20, 2026

Copy link
Copy Markdown
Member

Replace runtime type-tag dispatch + unsafeCoerce with three direct FFI functions: constant (takes Double, ArrayFire converts internally), constantComplex (preserves imaginary part via af_constant_complex), constantLong / constantULong (64-bit integers without Double rounding).

Add tests covering all four functions including precision boundaries (maxBound/minBound for Int and Word64).

Replace runtime type-tag dispatch + unsafeCoerce with three direct FFI
functions: constant (takes Double, ArrayFire converts internally),
constantComplex (preserves imaginary part via af_constant_complex),
constantLong / constantULong (64-bit integers without Double rounding).

Add tests covering all four functions including precision boundaries
(maxBound/minBound for Int and Word64).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dmjio dmjio changed the title Remove unsafeCoerce from Data.constant Remove unsafeCoerce from Data.constant Jun 20, 2026
@dmjio dmjio merged commit 630d7aa into master Jun 20, 2026
2 checks passed
@dmjio dmjio deleted the remove-unsafe-coerce branch June 20, 2026 07:38
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.

1 participant